1
0

refresh.asciidoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [[indices-refresh]]
  2. === Refresh API
  3. ++++
  4. <titleabbrev>Refresh</titleabbrev>
  5. ++++
  6. Refreshes one or more indices. For data streams, the API refreshes the stream's
  7. backing indices.
  8. [source,console]
  9. ----
  10. POST /twitter/_refresh
  11. ----
  12. // TEST[setup:twitter]
  13. [[refresh-api-request]]
  14. ==== {api-request-title}
  15. `POST <target>/_refresh`
  16. `GET <target>/_refresh`
  17. `POST /_refresh`
  18. `GET /_refresh`
  19. [[refresh-api-desc]]
  20. ==== {api-description-title}
  21. Use the refresh API to explicitly refresh one or more indices.
  22. If the request targets a data stream, it refreshes the stream's backing indices.
  23. A _refresh_ makes all operations performed on an index
  24. since the last refresh
  25. available for search.
  26. // tag::refresh-interval-default[]
  27. By default, Elasticsearch periodically refreshes indices every second, but only on
  28. indices that have received one search request or more in the last 30 seconds.
  29. // end::refresh-interval-default[]
  30. You can change this default interval
  31. using the <<index-refresh-interval-setting,`index.refresh_interval`>> setting.
  32. [IMPORTANT]
  33. ====
  34. Refreshes are resource-intensive.
  35. To ensure good cluster performance,
  36. we recommend waiting for {es}'s periodic refresh
  37. rather than performing an explicit refresh
  38. when possible.
  39. If your application workflow
  40. indexes documents and then runs a search
  41. to retrieve the indexed document,
  42. we recommend using the <<docs-index_,index API>>'s
  43. `refresh=wait_for` query parameter option.
  44. This option ensures the indexing operation waits
  45. for a periodic refresh
  46. before running the search.
  47. ====
  48. [[refresh-api-path-params]]
  49. ==== {api-path-parms-title}
  50. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
  51. +
  52. To refresh all indices in the cluster,
  53. omit this parameter
  54. or use a value of `_all` or `*`.
  55. [[refresh-api-query-params]]
  56. ==== {api-query-parms-title}
  57. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  58. +
  59. Defaults to `true`.
  60. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  61. +
  62. Defaults to `open`.
  63. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  64. [[refresh-api-example]]
  65. ==== {api-examples-title}
  66. [[refresh-api-multiple-ex]]
  67. ===== Refresh several data streams and indices
  68. [source,console]
  69. ----
  70. POST /kimchy,elasticsearch/_refresh
  71. ----
  72. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
  73. [[refresh-api-all-ex]]
  74. ===== Refresh all data streams and indices in a cluster
  75. [source,console]
  76. ----
  77. POST /_refresh
  78. ----