Flush APIedit

Flushes one or more indices.

POST /twitter/_flush

Requestedit

POST /<index>/_flush

GET /<index>/_flush

POST /_flush

GET /_flush

Descriptionedit

The flush API allows to flush one or more indices through an API. The flush process of an index makes sure that any data that is currently only persisted in the transaction log is also permanently persisted in Lucene. This reduces recovery times as that data doesn’t need to be reindexed from the transaction logs after the Lucene indexed is opened. By default, Elasticsearch uses heuristics in order to automatically trigger flushes as required. It is rare for users to need to call the API directly.

Path parametersedit

<index>

(Optional, string) Comma-separated list or wildcard expression of index names used to limit the request.

To flush all indices, omit this parameter or use a value of _all or *.

Query parametersedit

allow_no_indices

(Optional, boolean) If true, the request does not return an error if a wildcard expression or _all value retrieves only missing or closed indices.

This parameter also applies to index aliases that point to a missing or closed index.

expand_wildcards

(Optional, string) Controls what kind of indices that wildcard expressions can expand to. Valid values are:

all
Expand to open and closed indices.
open
Expand only to open indices.
closed
Expand only to closed indices.
none
Wildcard expressions are not accepted.

Defaults to open.

force

(Optional, boolean) If true, the request forces a flush even if there are no changes to commit to the index. Defaults to true.

You can use this parameter to increment the generation number of the transaction log.

This parameter is considered internal.

ignore_unavailable
(Optional, boolean) If true, missing or closed indices are not included in the response. Defaults to false.
wait_if_ongoing

(Optional, boolean) If true, the flush operation blocks until execution when another flush operation is running.

If false, Elasticsearch returns an error if you request a flush when another flush operation is running.

Defaults to true.

Examplesedit

Flush a specific indexedit

POST /kimchy/_flush

Flush several indicesedit

POST /kimchy,elasticsearch/_flush

Flush all indicesedit

POST /_flush