QRCache Plugin provides a feature of Query Result Cache for Elasticsearch. This cache is different from Shard Query Cache. Shard Query Cache stores a count(hits.total) of a query, not a response(hits). On the other hand, our Query Result Cache stores the response to a cache.
Version | Elasticsearch |
---|---|
master | 1.6.X |
1.6.0 | 1.6.0 |
1.5.0 | 1.5.0 |
Please file an issue. (Japanese forum is here.)
$ $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-extension/1.6.0
$ $ES_HOME/bin/plugin --install org.codelibs/elasticsearch-qrcache/1.6.0
Query Result Cache is enabled if index.cache.query_result.enable is set to true. (For 1.3, close the index before updating a setting)
curl -XPUT 'localhost:9200/my_index/_settings?index.cache.query_result.enable=true'
curl -XGET 'localhost:9200/_qrc/stats?pretty'
curl -XGET 'localhost:9200/my_index/_qrc/clear?pretty'
You can change parameters by elasticsearch.yml.
indices.cache.query_result.clean_interval: 10s
indices.cache.query_result.size: 1%
indices.cache.query_result.expire: 1m
clean_interval is an interval time for purging invalid caches, size is a total cache size and expire is an expire time for each cache.