Reputation:
I need to compare the 2 different indices(same data with different no of shards) for an elastic-search index, for which I am using some of my slow search queries and hitting on these indices but I am suspecting as one indices is getting the live traffic, hence its possible for my queries results are coming from cache.
Is there is any way to figure out, results are coming from cache or any param which we can specify to not bring results from cache ?
Upvotes: 6
Views: 4799
Reputation: 38502
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"
}
}
}
}
Upvotes: 4