Why is my term aggregation not getting cached into request cache?

I've an index on which I've explicitly enabled request cache using the following settings:

curl -XPUT 'localhost:9200/index_one?pretty' -H 'Content-Type: application/json' -d'
{
  "settings": {

    "index.requests.cache.enable": "true"
  },
 "mappings": {
    	"type_one": {
      		"properties": {
        		"status": {
          			"type": "keyword"
        		}
     		 }
    	}
  	}

}
'

I'm running this aggregation on it, which returns a successfully aggregated bucket.

curl -XGET 'localhost:9200/_search?&pretty' -H 'Content-Type: application/json' -d'
{
    "aggs" : {
        "availability" : {
            "terms" : { "field" : "status" }
        }
    }
}
'

But my request cache is empty.

"request_cache" : {
          "memory_size" : "0b",
          "memory_size_in_bytes" : 0,
          "evictions" : 0,
          "hit_count" : 0,
          "miss_count" : 0
        }

According to this link here, request cache ought to be caching aggregations. https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html
I'm using elasticsearch version 6.1.1

As mentioned in the shard request cache docs, this caching only happens when you set size: 0 in your request.

Can you try with that?

1 Like

Yup! That works. Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.