Filtering by geo_shape type

Hi,

I have a bunch of location indexed as geo_shapes. How can I filter all the ones that have a multipolygon type? For some reason the regular queries don't work inside the geo_shape object.

The mapping is defined like:

"geoJson": {
"type": "geo_shape"
}

And my query is:

"query": {
"match": {
"geoJson.type": "MultiPolygon"
}
}

And a sample from a document:

"geoJson": {
"type": "MultiPolygon",
"coordinates": [
[ lots of coords ]
]
}

How can I write a query that filters by the type of a geo_shape?

Thank you!

This type of query does not exist in Elasticsearch. The geo_shape is not store as GeoJSON in the index so the information on what type of shape it was is lost while indexing. If you want to search on this information, you will need to index the type as a separate keyword field alongside your geo_shape field

Given that the indexing process is not updated, is there a more efficient way of retrieving all the multipolygon shapes other than retrieving all the documents in batches and manually filtering the geojson field by its type?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.