2013-08-28 19:24:34 -04:00
|
|
|
[[indices-refresh]]
|
2019-10-04 13:50:09 -04:00
|
|
|
=== Refresh API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Refresh</titleabbrev>
|
|
|
|
++++
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
Refreshes one or more indices.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
2016-09-01 17:08:18 -04:00
|
|
|
POST /twitter/_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
2016-09-01 17:08:18 -04:00
|
|
|
// TEST[setup:twitter]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
[[refresh-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`POST <index>/_refresh`
|
|
|
|
|
|
|
|
`GET <index>/_refresh`
|
|
|
|
|
|
|
|
`POST /_refresh`
|
|
|
|
|
|
|
|
`GET /_refresh`
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
Use the refresh API to explicitly refresh one or more indices.
|
|
|
|
A _refresh_ makes all operations performed on an index
|
|
|
|
since the last refresh
|
|
|
|
available for search.
|
|
|
|
|
|
|
|
// tag::refresh-interval-default[]
|
|
|
|
By default, Elasticsearch periodically refreshes indices every second, but only on
|
|
|
|
indices that have received one search request or more in the last 30 seconds.
|
|
|
|
// end::refresh-interval-default[]
|
|
|
|
You can change this default interval
|
|
|
|
using the <<index-refresh-interval-setting,`index.refresh_interval`>> setting.
|
|
|
|
|
|
|
|
[IMPORTANT]
|
|
|
|
====
|
2020-01-09 14:35:05 -05:00
|
|
|
Refreshes are resource-intensive.
|
2019-10-04 13:50:09 -04:00
|
|
|
To ensure good cluster performance,
|
|
|
|
we recommend waiting for {es}'s periodic refresh
|
|
|
|
rather than performing an explicit refresh
|
|
|
|
when possible.
|
|
|
|
|
|
|
|
If your application workflow
|
|
|
|
indexes documents and then runs a search
|
|
|
|
to retrieve the indexed document,
|
|
|
|
we recommend using the <<docs-index_,index API>>'s
|
|
|
|
`refresh=wait_for` query parameter option.
|
|
|
|
This option ensures the indexing operation waits
|
|
|
|
for a periodic refresh
|
|
|
|
before running the search.
|
|
|
|
====
|
|
|
|
|
|
|
|
[[refresh-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
|
|
|
|
+
|
|
|
|
To refresh all indices in the cluster,
|
|
|
|
omit this parameter
|
|
|
|
or use a value of `_all` or `*`.
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
2020-02-24 05:57:32 -05:00
|
|
|
+
|
|
|
|
Defaults to `true`.
|
2019-10-04 13:50:09 -04:00
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
|
|
|
+
|
|
|
|
Defaults to `open`.
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-multiple-ex]]
|
|
|
|
===== Refresh several indices
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
2016-09-01 17:08:18 -04:00
|
|
|
POST /kimchy,elasticsearch/_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
|
|
|
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
|
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
[[refresh-api-all-ex]]
|
|
|
|
===== Refresh all indices
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
----
|
2016-09-01 17:08:18 -04:00
|
|
|
POST /_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|