Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 1.22 KB

80_Caching_geo_shapes.asciidoc

File metadata and controls

38 lines (34 loc) · 1.22 KB

Geo-shape Filters and Caching

The geo_shape query and filter perform the same function. The query simply acts as a filter: any matching documents receive a relevance _score of 1. Query results cannot be cached, but filter results can be.

The results are not cached by default. Just as with geo-points, any change in the coordinates in a shape are likely to produce a different set of geohashes, so there is little point in caching filter results. That said, if you filter using the same shapes repeatedly, it can be worth caching the results, by setting _cache to true:

GET /attractions/neighborhood/_search
{
  "query": {
    "filtered": {
      "filter": {
        "geo_shape": {
          "_cache": true, (1)
          "location": {
            "indexed_shape": {
              "index": "attractions",
              "type":  "landmark",
              "id":    "dam_square",
              "path":  "location"
            }
          }
        }
      }
    }
  }
}
  1. The results of this geo_shape filter will be cached.