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
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
Refreshes one or more indices. For data streams, the API refreshes the stream's
|
|
|
|
backing 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
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
POST /my-index-000001/_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[setup:my_index]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
[[refresh-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
`POST <target>/_refresh`
|
2019-10-04 13:50:09 -04:00
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
`GET <target>/_refresh`
|
2019-10-04 13:50:09 -04:00
|
|
|
|
|
|
|
`POST /_refresh`
|
|
|
|
|
|
|
|
`GET /_refresh`
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
Use the refresh API to explicitly refresh one or more indices.
|
2020-07-13 09:05:03 -04:00
|
|
|
If the request targets a data stream, it refreshes the stream's backing indices.
|
2019-10-04 13:50:09 -04:00
|
|
|
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.
|
|
|
|
|
2020-07-31 16:22:34 -04:00
|
|
|
Refresh requests are synchronous and do not return a response until the
|
|
|
|
refresh operation completes.
|
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
[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}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
|
2019-10-04 13:50:09 -04:00
|
|
|
+
|
|
|
|
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}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/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
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
2019-10-04 13:50:09 -04:00
|
|
|
+
|
|
|
|
Defaults to `open`.
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
2019-10-04 13:50:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
|
|
|
|
[[refresh-api-multiple-ex]]
|
2020-07-13 09:05:03 -04:00
|
|
|
===== Refresh several data streams and 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
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
POST /my-index-000001,my-index-000002/_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/]
|
2019-10-04 13:50:09 -04:00
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-10-04 13:50:09 -04:00
|
|
|
[[refresh-api-all-ex]]
|
2020-07-13 09:05:03 -04:00
|
|
|
===== Refresh all data streams and indices in a cluster
|
2019-10-04 13:50:09 -04:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
----
|
2016-09-01 17:08:18 -04:00
|
|
|
POST /_refresh
|
2019-10-04 13:50:09 -04:00
|
|
|
----
|