为什么这个缓存的地理查询在弹性搜索中比未缓存的更慢?

时间:2015-06-04 18:32:56

标签: performance caching elasticsearch geo

查看下面的查询,我在geo_shape过滤器前面添加了一个缓存的geo_bounding_box过滤器。我在阅读https://www.elastic.co/guide/en/elasticsearch/guide/current/geo-caching.html后的期望是这个查询应该更快。但是,在我的基准测试中,使用两个过滤器的查询平均稍微慢一点,而在最坏的情况下则慢得多。我做错了什么,或者误解了文档?

{
    "query": {
        "filtered": {
            "filter": {
                "bool" : {
                    "must" : [
                        {"geo_bounding_box" : {
                            "_cache": True,
                            "properties.center" : {
                                "top_left" : {
                                    "lat" : math.ceil(float(lat)),
                                    "lon" : math.floor(float(lon))
                                },
                                "bottom_right" : {
                                    "lat" : math.floor(float(lat)),
                                    "lon" : math.ceil(float(lon))
                                }
                            }
                        }},
                        {"geo_shape": {
                            "geometry": {
                                "relation": "intersects",
                                "shape": {
                                    "coordinates": [lon,lat],
                                    "type": "point"
                                }
                            }
                        }}
                    ]
                }
            }
        }
    }
}

1 个答案:

答案 0 :(得分:0)

使用小写JSON布尔值:

"_cache": true