Does elasticsearch geospatial aggregation use case?

(saipa) #1

I have a question about if elasticsearch use cases. I have two files. One contains the boundaries of each state in the US. Another file contains the boundaries of north, south, east, and west regions of the US. Each boundary has a unique identiifer (either by state, or by region). If my document has only a latitude longitude field geospatially indexed (it does not contain a state field or a "region" field), is elasticsearch able to output aggregations based on "state" or "region" based on the boundaries I pass/tell elasticsearch about? Or is this not supported and I have to put "state" and "region" fields into each document I index to be able to aggregate?

(Colin Goodheart-Smithe) #2

You could achieve this by using the filters aggregation and defining a geo_polygon query for each state/region within this aggregation to group your results by each state/region.

Hope that helps

(system) #3