refresh.asciidoc 2.2 KB

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