Skip to content

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

Merged
benwtrent merged 1 commit intoelastic:7.xfrom
benwtrent:feature/ml-df-add-centroid-support-7.x
May 17, 2019
Merged

[ML] adds geo_centroid aggregation support to data frames (#42088)#42094
benwtrent merged 1 commit intoelastic:7.xfrom
benwtrent:feature/ml-df-add-centroid-support-7.x

Conversation

@benwtrent
Copy link
Copy Markdown
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
Copy Markdown
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