Elasticsearch cache seems doesn't work

Hi,
I deployed an Elasticsearch5.4 cluster on server. It seems that the cache of Elasticsearch doesnt' work. Here is the detail.
One server with CentOS6.7, 16 cores and 64 GB memory. A cluster with 2 nodes on this server. The node settings to the elasticsearch.yml :
indices.queries.cache.size: 20%
indices.requests.cache.size: 5%
Also I created 3 indexes with settings like this:
"settings": {
"number_of_shards" : 2,
"number_of_replicas" : 1,
"index.requests.cache.enable": true
}

After that, I started the cluster. Used Apache Bench to do the load test such as 10k requests or 1k requests.
I found that the search took time increased from several ms to several seconds. More then 10 seconds at last. This is my query:
GET /members/member/_search
{
"from" : 0,
"size" : 15,
"query" : {
"multi_match" : {
"query" : "London",
"fields" : [
"cityName^1.0",
"nickname^1.0",
"remark^1.0",
"uid^1.0"
],
"type" : "most_fields",
"operator" : "AND",
"slop" : 0,
"prefix_length" : 0,
"max_expansions" : 50,
"lenient" : false,
"zero_terms_query" : "NONE",
"boost" : 1.0
}
},
"highlight" : {
"pre_tags" : [
""
],
"post_tags" : [
"
"
],
"fields" : {
"nickname" : { },
"remark" : { },
"cityName" : { }
}
}
}

Then I checked the request cache with this command. GET /_stats/request_cache?human&pretty.
This is the response:
{
"_shards" : {
"total" : 12,
"successful" : 12,
"failed" : 0
},
"_all" : {
"primaries" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
},
"total" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
}
},
"indices" : {
"members" : {
"primaries" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
},
"total" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
}
},
"videos" : {
"primaries" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
},
"total" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
}
},
"products" : {
"primaries" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
},
"total" : {
"request_cache" : {
"memory_size" : "0b",
"memory_size_in_bytes" : 0,
"evictions" : 0,
"hit_count" : 0,
"miss_count" : 0
}
}
}
}
}

So I guess I made something wrong with the cache settings. Can anyone give me suggestion?
Thanks!

Ray

I read the cache chapter again and found this.
shard request cache

Requests size is greater than 0 will not be cached even if the request cache is enabled in the index settings. To cache these requests you will need to use the query-string parameter detailed here.

But where the query-string parameter detailed? Then i read the query-string query. I'm not sure there is any parameter about size.

Yes, i need to process search result with page. That drives me crazy. Does anyone face the same problem as i faced?

1 Like

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