OpenSearch/docs/reference/indices/warmers.asciidoc

185 lines
4.6 KiB
Plaintext
Raw Normal View History

[[indices-warmers]]
== Warmers
Index 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
2014-03-07 08:21:45 -05:00
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.
[float]
[[creation]]
=== Index Creation / Templates
Warmers can be registered when an index gets created, for example:
[source,js]
--------------------------------------------------
curl -XPUT localhost:9200/test -d '{
"warmers" : {
"warmer_1" : {
"types" : [],
"source" : {
"query" : {
...
},
"aggs" : {
...
}
}
}
}
}'
--------------------------------------------------
Or, in an index template:
[source,js]
--------------------------------------------------
curl -XPUT localhost:9200/_template/template_1 -d '
{
"template" : "te*",
"warmers" : {
"warmer_1" : {
"types" : [],
"source" : {
"query" : {
...
},
"aggs" : {
...
}
}
}
}
}'
--------------------------------------------------
[float]
[[warmer-adding]]
=== Put Warmer
Allows 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:
[source,js]
--------------------------------------------------
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:
[source,js]
--------------------------------------------------
curl -XPUT localhost:9200/test/type1/_warmer/warmer_1 -d '{
"query" : {
"match_all" : {}
},
"aggs" : {
"aggs_1" : {
"terms" : {
"field" : "field"
}
}
}
}'
--------------------------------------------------
Make PUT and DELETE consistent for _mapping, _alias and _warmer See issue #4071 PUT options for _mapping: Single type can now be added with `[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type` and `[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]` PUT options for _warmer: PUT with a single warmer can now be done with `[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name` PUT options for _alias: Single alias can now be PUT with `[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias` DELETE options _mapping: Several mappings can be deleted at once by defining several indices and types with `[DELETE] /{index}/{type}` `[DELETE] /{index}/{type}/_mapping` `[DELETE] /{index}/_mapping/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_mapings` can be used. DELETE options for _warmer: Several warmers can be deleted at once by defining several indices and names with `[DELETE] /{index}/_warmer/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_warmers` can be used. DELETE options for _alias: Several aliases can be deleted at once by defining several indices and names with `[DELETE] /{index}/_alias/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_aliases` can be used.
2014-01-08 04:34:48 -05:00
All options:
[source,js]
--------------------------------------------------
PUT _warmer/{warmer_name}
PUT /{index}/_warmer/{warmer_name}
PUT /{index}/{type}/_warmer/{warmer_name}
--------------------------------------------------
where
[horizontal]
`{index}`:: `* | _all | glob pattern | name1, name2, …`
`{type}`:: `* | _all | glob pattern | name1, name2, …`
Instead of `_warmer` you can also use the plural `_warmers`.
[float]
[[removing]]
Make PUT and DELETE consistent for _mapping, _alias and _warmer See issue #4071 PUT options for _mapping: Single type can now be added with `[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type` and `[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]` PUT options for _warmer: PUT with a single warmer can now be done with `[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name` PUT options for _alias: Single alias can now be PUT with `[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias` DELETE options _mapping: Several mappings can be deleted at once by defining several indices and types with `[DELETE] /{index}/{type}` `[DELETE] /{index}/{type}/_mapping` `[DELETE] /{index}/_mapping/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_mapings` can be used. DELETE options for _warmer: Several warmers can be deleted at once by defining several indices and names with `[DELETE] /{index}/_warmer/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_warmers` can be used. DELETE options for _alias: Several aliases can be deleted at once by defining several indices and names with `[DELETE] /{index}/_alias/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_aliases` can be used.
2014-01-08 04:34:48 -05:00
=== Delete Warmers
Warmers can be deleted using the following endpoint:
[source,js]
--------------------------------------------------
Make PUT and DELETE consistent for _mapping, _alias and _warmer See issue #4071 PUT options for _mapping: Single type can now be added with `[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type` and `[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]` PUT options for _warmer: PUT with a single warmer can now be done with `[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name` PUT options for _alias: Single alias can now be PUT with `[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias` DELETE options _mapping: Several mappings can be deleted at once by defining several indices and types with `[DELETE] /{index}/{type}` `[DELETE] /{index}/{type}/_mapping` `[DELETE] /{index}/_mapping/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_mapings` can be used. DELETE options for _warmer: Several warmers can be deleted at once by defining several indices and names with `[DELETE] /{index}/_warmer/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_warmers` can be used. DELETE options for _alias: Several aliases can be deleted at once by defining several indices and names with `[DELETE] /{index}/_alias/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_aliases` can be used.
2014-01-08 04:34:48 -05:00
[DELETE] /{index}/_warmer/{name}
--------------------------------------------------
Make PUT and DELETE consistent for _mapping, _alias and _warmer See issue #4071 PUT options for _mapping: Single type can now be added with `[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type` and `[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]` PUT options for _warmer: PUT with a single warmer can now be done with `[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name` PUT options for _alias: Single alias can now be PUT with `[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias` DELETE options _mapping: Several mappings can be deleted at once by defining several indices and types with `[DELETE] /{index}/{type}` `[DELETE] /{index}/{type}/_mapping` `[DELETE] /{index}/_mapping/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_mapings` can be used. DELETE options for _warmer: Several warmers can be deleted at once by defining several indices and names with `[DELETE] /{index}/_warmer/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_warmers` can be used. DELETE options for _alias: Several aliases can be deleted at once by defining several indices and names with `[DELETE] /{index}/_alias/{type}` where `index= * | _all | glob pattern | name1, name2, …` `type= * | _all | glob pattern | name1, name2, …` Alternatively, the keyword `_aliases` can be used.
2014-01-08 04:34:48 -05:00
where
[horizontal]
`{index}`:: `* | _all | glob pattern | name1, name2, …`
`{name}`:: `* | _all | glob pattern | name1, name2, …`
Instead of `_warmer` you can also use the plural `_warmers`.
[float]
[[warmer-retrieving]]
=== GETting Warmer
Getting 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. Some examples:
[source,js]
--------------------------------------------------
# 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/
--------------------------------------------------