WARNING: Version 1.4 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Warmers
editWarmers
editIndex warming allows to run registered search requests to warm up the index before it is available for search. With the near real time aspect of search, cold data (segments) will be warmed up before they become available for search. This includes things such as the filter cache, filesystem cache, and loading field data for fields.
Warmup searches typically include requests that require heavy loading of data, such as aggregations or sorting on specific fields. The warmup APIs allows to register warmup (search) under specific names, remove them, and get them.
Index warmup can be disabled by setting index.warmer.enabled
to
false
. It is supported as a realtime setting using update settings
API. This can be handy when doing initial bulk indexing: disable pre
registered warmers to make indexing faster and less expensive and then
enable it.
Index Creation / Templates
editWarmers can be registered when an index gets created, for example:
curl -XPUT localhost:9200/test -d '{ "warmers" : { "warmer_1" : { "types" : [], "source" : { "query" : { ... }, "aggs" : { ... } } } } }'
Or, in an index template:
curl -XPUT localhost:9200/_template/template_1 -d ' { "template" : "te*", "warmers" : { "warmer_1" : { "types" : [], "source" : { "query" : { ... }, "aggs" : { ... } } } } }'
Added in 1.4.0.Beta1.
On the same level as types
and source
, the query_cache
flag is supported
to enable query caching for the warmed search request. If not specified, it will
use the index level configuration of query caching.
Put Warmer
editAllows to put a warmup search request on a specific index (or indices), with the body composing of a regular search request. Types can be provided as part of the URI if the search request is designed to be run only against the specific types.
Here is an example that registers a warmup called warmer_1
against
index test
(can be alias or several indices), for a search request
that runs against all types:
curl -XPUT localhost:9200/test/_warmer/warmer_1 -d '{ "query" : { "match_all" : {} }, "aggs" : { "aggs_1" : { "terms" : { "field" : "field" } } } }'
And an example that registers a warmup against specific types:
curl -XPUT localhost:9200/test/type1/_warmer/warmer_1 -d '{ "query" : { "match_all" : {} }, "aggs" : { "aggs_1" : { "terms" : { "field" : "field" } } } }'
All options:
PUT _warmer/{warmer_name} PUT /{index}/_warmer/{warmer_name} PUT /{index}/{type}/_warmer/{warmer_name}
where
|
|
|
|
Instead of _warmer
you can also use the plural _warmers
.
Added in 1.4.0.Beta1.
The query_cache
parameter can be used to enable query caching for
the search request. If not specified, it will use the index level configuration
of query caching.
Delete Warmers
editWarmers can be deleted using the following endpoint:
[DELETE] /{index}/_warmer/{name}
where
|
|
|
|
Instead of _warmer
you can also use the plural _warmers
.
GETting Warmer
editGetting a warmer for specific index (or alias, or several indices) based on its name. The provided name can be a simple wildcard expression or omitted to get all warmers.
Added in 1.4.0.Beta1.
The API will always include a warmers
section, even if there aren’t any warmers. Previous versions would not return the warmers
section
Some examples:
# get warmer named warmer_1 on test index curl -XGET localhost:9200/test/_warmer/warmer_1 # get all warmers that start with warm on test index curl -XGET localhost:9200/test/_warmer/warm* # get all warmers for test index curl -XGET localhost:9200/test/_warmer/