geo.asciidoc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [role="xpack"]
  2. [[ml-geo-functions]]
  3. === Geographic functions
  4. The geographic functions detect anomalies in the geographic location of the
  5. input data.
  6. The {ml-features} include the following geographic function: `lat_long`.
  7. NOTE: You cannot create forecasts for {anomaly-jobs} that contain geographic
  8. functions. You also cannot add rules with conditions to detectors that use
  9. geographic functions.
  10. [float]
  11. [[ml-lat-long]]
  12. ==== Lat_long
  13. The `lat_long` function detects anomalies in the geographic location of the
  14. input data.
  15. This function supports the following properties:
  16. * `field_name` (required)
  17. * `by_field_name` (optional)
  18. * `over_field_name` (optional)
  19. * `partition_field_name` (optional)
  20. For more information about those properties,
  21. see {ref}/ml-job-resource.html#ml-detectorconfig[Detector configuration objects].
  22. .Example 1: Analyzing transactions with the lat_long function
  23. [source,js]
  24. --------------------------------------------------
  25. PUT _ml/anomaly_detectors/example1
  26. {
  27. "analysis_config": {
  28. "detectors": [{
  29. "function" : "lat_long",
  30. "field_name" : "transactionCoordinates",
  31. "by_field_name" : "creditCardNumber"
  32. }]
  33. },
  34. "data_description": {
  35. "time_field":"timestamp",
  36. "time_format": "epoch_ms"
  37. }
  38. }
  39. --------------------------------------------------
  40. // CONSOLE
  41. // TEST[skip:needs-licence]
  42. If you use this `lat_long` function in a detector in your {anomaly-job}, it
  43. detects anomalies where the geographic location of a credit card transaction is
  44. unusual for a particular customer’s credit card. An anomaly might indicate fraud.
  45. IMPORTANT: The `field_name` that you supply must be a single string that contains
  46. two comma-separated numbers of the form `latitude,longitude`, a `geo_point` field,
  47. a `geo_shape` field that contains point values, or a `geo_centroid` aggregation.
  48. The `latitude` and `longitude` must be in the range -180 to 180 and represent a
  49. point on the surface of the Earth.
  50. For example, JSON data might contain the following transaction coordinates:
  51. [source,js]
  52. --------------------------------------------------
  53. {
  54. "time": 1460464275,
  55. "transactionCoordinates": "40.7,-74.0",
  56. "creditCardNumber": "1234123412341234"
  57. }
  58. --------------------------------------------------
  59. // NOTCONSOLE
  60. In {es}, location data is likely to be stored in `geo_point` fields. For more
  61. information, see {ref}/geo-point.html[Geo-point datatype]. This data type is
  62. supported natively in {ml-features}. Specifically, {dfeed} when pulling data from
  63. a `geo_point` field, will transform the data into the appropriate `lat,lon` string
  64. format before sending to the {anomaly-job}.
  65. For more information, see <<ml-configuring-transform>>.