Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] adds geo_centroid aggregation support to data frames (#42088) #42094

Merged

Conversation

benwtrent
Copy link
Member

This adds support for the geo_centroid aggregation. The mapped type that supports geo_centroid is always geo_point. So, I opted to make that the static destination mapped type as well. ES supports geo_point _sources being index in the form of lat, lon so calling .toString on the aggregation results is good enough to build the document source.

This opens up some interesting use cases to show the centroid for specific entities when the data is pivoted. An example using kibana_sample_data_logs

PUT _data_frame/transforms/geo_test
{
  "source": {
    "index": "kibana_sample_data_logs"
  }
  ,"dest": {"index": "geo_test"}
  , "pivot": {
    "group_by": {
      "clientip": {"terms": {"field": "clientip"}}
    },
    "aggregations": {
      "location": {
        "geo_centroid": {
          "field":"geo.coordinates"
        }
      }
    }
  }
}

backport of #42088

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core

@benwtrent benwtrent merged commit f244736 into elastic:7.x May 17, 2019
@benwtrent benwtrent deleted the feature/ml-df-add-centroid-support-7.x branch May 17, 2019 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants