|
1 | 1 | [[indices-refresh]] |
2 | | -=== Refresh |
| 2 | +=== Refresh API |
| 3 | +++++ |
| 4 | +<titleabbrev>Refresh</titleabbrev> |
| 5 | +++++ |
3 | 6 |
|
4 | | -The refresh API allows to explicitly refresh one or more index, making |
5 | | -all operations performed since the last refresh available for search. |
6 | | -The (near) real-time capabilities depend on the index engine used. For |
7 | | -example, the internal one requires refresh to be called, but by default a |
8 | | -refresh is scheduled periodically. |
| 7 | +Refreshes one or more indices. |
9 | 8 |
|
10 | | -[source,js] |
11 | | --------------------------------------------------- |
| 9 | +[source,console] |
| 10 | +---- |
12 | 11 | POST /twitter/_refresh |
13 | | --------------------------------------------------- |
14 | | -// CONSOLE |
| 12 | +---- |
15 | 13 | // TEST[setup:twitter] |
16 | 14 |
|
17 | | -[float] |
18 | | -==== Multi Index |
19 | 15 |
|
20 | | -The refresh API can be applied to more than one index with a single |
21 | | -call, or even on `_all` the indices. |
| 16 | +[[refresh-api-request]] |
| 17 | +==== {api-request-title} |
22 | 18 |
|
23 | | -[source,js] |
24 | | --------------------------------------------------- |
| 19 | +`POST <index>/_refresh` |
| 20 | + |
| 21 | +`GET <index>/_refresh` |
| 22 | + |
| 23 | +`POST /_refresh` |
| 24 | + |
| 25 | +`GET /_refresh` |
| 26 | + |
| 27 | + |
| 28 | +[[refresh-api-desc]] |
| 29 | +==== {api-description-title} |
| 30 | + |
| 31 | +Use the refresh API to explicitly refresh one or more indices. |
| 32 | +A _refresh_ makes all operations performed on an index |
| 33 | +since the last refresh |
| 34 | +available for search. |
| 35 | + |
| 36 | +// tag::refresh-interval-default[] |
| 37 | +By default, Elasticsearch periodically refreshes indices every second, but only on |
| 38 | +indices that have received one search request or more in the last 30 seconds. |
| 39 | +// end::refresh-interval-default[] |
| 40 | +You can change this default interval |
| 41 | +using the <<index-refresh-interval-setting,`index.refresh_interval`>> setting. |
| 42 | + |
| 43 | +[IMPORTANT] |
| 44 | +==== |
| 45 | +Refreshes are a resource-intensive. |
| 46 | +To ensure good cluster performance, |
| 47 | +we recommend waiting for {es}'s periodic refresh |
| 48 | +rather than performing an explicit refresh |
| 49 | +when possible. |
| 50 | +
|
| 51 | +If your application workflow |
| 52 | +indexes documents and then runs a search |
| 53 | +to retrieve the indexed document, |
| 54 | +we recommend using the <<docs-index_,index API>>'s |
| 55 | +`refresh=wait_for` query parameter option. |
| 56 | +This option ensures the indexing operation waits |
| 57 | +for a periodic refresh |
| 58 | +before running the search. |
| 59 | +==== |
| 60 | + |
| 61 | +[[refresh-api-path-params]] |
| 62 | +==== {api-path-parms-title} |
| 63 | + |
| 64 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=index] |
| 65 | ++ |
| 66 | +To refresh all indices in the cluster, |
| 67 | +omit this parameter |
| 68 | +or use a value of `_all` or `*`. |
| 69 | + |
| 70 | + |
| 71 | +[[refresh-api-query-params]] |
| 72 | +==== {api-query-parms-title} |
| 73 | + |
| 74 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices] |
| 75 | + |
| 76 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards] |
| 77 | ++ |
| 78 | +Defaults to `open`. |
| 79 | + |
| 80 | +include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable] |
| 81 | + |
| 82 | + |
| 83 | +[[refresh-api-example]] |
| 84 | +==== {api-examples-title} |
| 85 | + |
| 86 | + |
| 87 | +[[refresh-api-multiple-ex]] |
| 88 | +===== Refresh several indices |
| 89 | + |
| 90 | +[source,console] |
| 91 | +---- |
25 | 92 | POST /kimchy,elasticsearch/_refresh |
| 93 | +---- |
| 94 | +// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/] |
26 | 95 |
|
| 96 | + |
| 97 | +[[refresh-api-all-ex]] |
| 98 | +===== Refresh all indices |
| 99 | + |
| 100 | +[source,console] |
| 101 | +---- |
27 | 102 | POST /_refresh |
28 | | --------------------------------------------------- |
29 | | -// CONSOLE |
30 | | -// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/] |
| 103 | +---- |
0 commit comments