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