Flush API
editFlush API
editFlushes one or more data streams or indices.
POST /my-index-000001/_flush
Description
editFlushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.
Once each operation has been flushed it is permanently stored in the Lucene index. This may mean that there is no need to maintain an additional copy of it in the transaction log, unless it is retained for some other reason. The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files once they are no longer needed, freeing up disk space.
It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.
Path parameters
edit-
<target>
-
(Optional, string) Comma-separated list of data streams, indices, and index aliases to flush. Wildcard expressions (
*
) are supported.To flush all data streams and indices in a cluster, omit this parameter or use
_all
or*
.
Query parameters
edit-
allow_no_indices
-
(Optional, Boolean) If
false
, the request returns an error when a wildcard expression, index alias, or_all
value targets only missing or closed indices.Defaults to
true
. -
expand_wildcards
-
(Optional, string) Controls what kind of indices that wildcard expressions can expand to. Multiple values are accepted when separated by a comma, as in
open,hidden
. Valid values are:-
all
- Expand to open and closed indices, including hidden indices.
-
open
- Expand only to open indices.
-
closed
- Expand only to closed indices.
-
hidden
-
Expansion of wildcards will include hidden indices.
Must be combined with
open
,closed
, or both. -
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 totrue
.You can use this parameter to increment the generation number of the transaction log.
This parameter is considered internal.
-
ignore_unavailable
-
(Optional, Boolean) If
false
, the request returns an error if it targets a missing or closed index. Defaults tofalse
. -
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
.