I have 2 types of document as below.
- poi: 4 millions, it has a point(lon, lat) field
- region: it has a polygon field
I'd like to search POI documents in a certain region by using geo_shape
filter.
So I made query as below.
{
"query": {
"filtered": {
"query": {
"match_all": {}
}
, "filter": {
"and": [
{"term": {"properties.category1":"2"}}
, {"term": {"properties.category2":"1"}}
, {"term": {"properties.category3":"1"}}
, {"prefix": {"title":"xxx"}}
]
}
}
}
, "post_filter": {
"geo_shape": {
"geometry": {
"indexed_shape": {
"id": "21000",
"type": "region",
"index": "test",
"shape_field_name": "geometry"
}
}
}
}
}
The count of POI that's title contains 'xxx' is* only 4.*
But the response time of this query was 20 seconds.
so I tested this query without the geo_shape and post_filter.
{
"query": {
"filtered": {
"query": {
"match_all": {}
}
, "filter": {
"and": [
{"term": {"properties.category1":"2"}}
, {"term": {"properties.category2":"1"}}
, {"term": {"properties.category3":"1"}}
, {"prefix": {"title":"xxx"}}
]
}
}
}
}
Result count of this query was only 4 and It took only 10 ms.
I though that the number of POI documents that are applied to geo_shape
filter is only 4 by using post_filter.
Why post_filter + geo_shape filters are so slow?
Did I use the post_filter + geo_shape query correctlly?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6f578e25-beef-4c11-a913-605834fe4dae%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.