Check if elasticsearch query results are coming from cache or not?
By default, the requests cache will only cache the results of search requests where size=0, so it will not cache
hits
, but it will cachehits.total
,aggregations
, andsuggestions
.
The request_cache
query-string parameter can be used to enable or disable caching on a per-request basis. If set, it overrides the index-level setting:
GET /my_index/_search?request_cache=true{ "size": 0, "aggs": { "popular_colors": { "terms": { "field": "colors" } } }}