2015-06-04 15 views
0

查看下面的查詢,我在我的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" 
           } 
          } 
         }} 
        ] 
       } 
      } 
     } 
    } 
} 

回答

0

使用小寫JSON布爾值:

"_cache": true