[[indices-refresh]] === Refresh API ++++ Refresh ++++ Refreshes one or more indices. For data streams, the API refreshes the stream's backing indices. [source,console] ---- POST /twitter/_refresh ---- // TEST[setup:twitter] [[refresh-api-request]] ==== {api-request-title} `POST /_refresh` `GET /_refresh` `POST /_refresh` `GET /_refresh` [[refresh-api-desc]] ==== {api-description-title} Use the refresh API to explicitly refresh one or more indices. If the request targets a data stream, it refreshes the stream's backing 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 <> setting. [IMPORTANT] ==== Refreshes are resource-intensive. 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 <>'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::{es-repo-dir}/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::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices] + Defaults to `true`. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards] + Defaults to `open`. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable] [[refresh-api-example]] ==== {api-examples-title} [[refresh-api-multiple-ex]] ===== Refresh several data streams and indices [source,console] ---- POST /kimchy,elasticsearch/_refresh ---- // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/] [[refresh-api-all-ex]] ===== Refresh all data streams and indices in a cluster [source,console] ---- POST /_refresh ----