warmers.asciidoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. [[indices-warmers]]
  2. == Warmers
  3. Index warming allows to run registered search requests to warm up the index
  4. before it is available for search. With the near real time aspect of search,
  5. cold data (segments) will be warmed up before they become available for search.
  6. This includes things such as the filter cache, filesystem cache, and loading
  7. field data for fields.
  8. Warmup searches typically include requests that require heavy loading of
  9. data, such as aggregations or sorting on specific fields. The warmup APIs
  10. allows to register warmup (search) under specific names, remove them,
  11. and get them.
  12. Index warmup can be disabled by setting `index.warmer.enabled` to
  13. `false`. It is supported as a realtime setting using update settings
  14. API. This can be handy when doing initial bulk indexing: disable pre
  15. registered warmers to make indexing faster and less expensive and then
  16. enable it.
  17. [float]
  18. [[creation]]
  19. === Index Creation / Templates
  20. Warmers can be registered when an index gets created, for example:
  21. [source,js]
  22. --------------------------------------------------
  23. curl -XPUT localhost:9200/test -d '{
  24. "warmers" : {
  25. "warmer_1" : {
  26. "types" : [],
  27. "source" : {
  28. "query" : {
  29. ...
  30. },
  31. "aggs" : {
  32. ...
  33. }
  34. }
  35. }
  36. }
  37. }'
  38. --------------------------------------------------
  39. Or, in an index template:
  40. [source,js]
  41. --------------------------------------------------
  42. curl -XPUT localhost:9200/_template/template_1 -d '
  43. {
  44. "template" : "te*",
  45. "warmers" : {
  46. "warmer_1" : {
  47. "types" : [],
  48. "source" : {
  49. "query" : {
  50. ...
  51. },
  52. "aggs" : {
  53. ...
  54. }
  55. }
  56. }
  57. }
  58. }'
  59. --------------------------------------------------
  60. On the same level as `types` and `source`, the `request_cache` flag is supported
  61. to enable request caching for the warmed search request. If not specified, it will
  62. use the index level configuration of query caching.
  63. [float]
  64. [[warmer-adding]]
  65. === Put Warmer
  66. Allows to put a warmup search request on a specific index (or indices),
  67. with the body composing of a regular search request. Types can be
  68. provided as part of the URI if the search request is designed to be run
  69. only against the specific types.
  70. Here is an example that registers a warmup called `warmer_1` against
  71. index `test` (can be alias or several indices), for a search request
  72. that runs against all types:
  73. [source,js]
  74. --------------------------------------------------
  75. curl -XPUT localhost:9200/test/_warmer/warmer_1 -d '{
  76. "query" : {
  77. "match_all" : {}
  78. },
  79. "aggs" : {
  80. "aggs_1" : {
  81. "terms" : {
  82. "field" : "field"
  83. }
  84. }
  85. }
  86. }'
  87. --------------------------------------------------
  88. And an example that registers a warmup against specific types:
  89. [source,js]
  90. --------------------------------------------------
  91. curl -XPUT localhost:9200/test/type1/_warmer/warmer_1 -d '{
  92. "query" : {
  93. "match_all" : {}
  94. },
  95. "aggs" : {
  96. "aggs_1" : {
  97. "terms" : {
  98. "field" : "field"
  99. }
  100. }
  101. }
  102. }'
  103. --------------------------------------------------
  104. All options:
  105. [source,js]
  106. --------------------------------------------------
  107. PUT _warmer/{warmer_name}
  108. PUT /{index}/_warmer/{warmer_name}
  109. PUT /{index}/{type}/_warmer/{warmer_name}
  110. --------------------------------------------------
  111. where
  112. [horizontal]
  113. `{index}`:: `* | _all | glob pattern | name1, name2, …`
  114. `{type}`:: `* | _all | glob pattern | name1, name2, …`
  115. Instead of `_warmer` you can also use the plural `_warmers`.
  116. The `request_cache` parameter can be used to enable request caching for
  117. the search request. If not specified, it will use the index level configuration
  118. of query caching.
  119. [float]
  120. [[removing]]
  121. === Delete Warmers
  122. Warmers can be deleted using the following endpoint:
  123. [source,js]
  124. --------------------------------------------------
  125. [DELETE] /{index}/_warmer/{name}
  126. --------------------------------------------------
  127. where
  128. [horizontal]
  129. `{index}`:: `* | _all | glob pattern | name1, name2, …`
  130. `{name}`:: `* | _all | glob pattern | name1, name2, …`
  131. Instead of `_warmer` you can also use the plural `_warmers`.
  132. [float]
  133. [[warmer-retrieving]]
  134. === GETting Warmer
  135. Getting a warmer for specific index (or alias, or several indices) based
  136. on its name. The provided name can be a simple wildcard expression or
  137. omitted to get all warmers.
  138. Some examples:
  139. [source,js]
  140. --------------------------------------------------
  141. # get warmer named warmer_1 on test index
  142. curl -XGET localhost:9200/test/_warmer/warmer_1
  143. # get all warmers that start with warm on test index
  144. curl -XGET localhost:9200/test/_warmer/warm*
  145. # get all warmers for test index
  146. curl -XGET localhost:9200/test/_warmer/
  147. --------------------------------------------------