2013-08-28 19:24:34 -04:00
|
|
|
[[indices-flush]]
|
2019-09-30 08:42:52 -04:00
|
|
|
=== Flush API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Flush</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
2020-07-02 17:26:49 -04:00
|
|
|
Flushes one or more data streams or indices.
|
2019-09-30 08:42:52 -04:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST /twitter/_flush
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:twitter]
|
|
|
|
|
|
|
|
|
|
|
|
[[flush-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2020-07-02 17:26:49 -04:00
|
|
|
`POST /<target>/_flush`
|
2019-09-30 08:42:52 -04:00
|
|
|
|
2020-07-02 17:26:49 -04:00
|
|
|
`GET /<target>/_flush`
|
2019-09-30 08:42:52 -04:00
|
|
|
|
2019-11-27 09:26:57 -05:00
|
|
|
`POST /_flush`
|
2019-09-30 08:42:52 -04:00
|
|
|
|
2019-11-27 09:26:57 -05:00
|
|
|
`GET /_flush`
|
2019-09-30 08:42:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[flush-api-desc]]
|
|
|
|
==== {api-description-title}
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2020-07-02 17:26:49 -04:00
|
|
|
Flushing a data stream or index is the process of making sure that any data that is currently
|
2019-09-04 11:37:00 -04:00
|
|
|
only stored in the <<index-modules-translog,transaction log>> is also
|
|
|
|
permanently stored in the Lucene index. When restarting, {es} 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. {es} 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 <<index-modules-translog-retention,it is retained
|
|
|
|
for some other reason>>. The transaction log is made up of multiple files,
|
|
|
|
called _generations_, and {es} 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 {es} has flushed all the documents that were indexed before the
|
|
|
|
flush API was called.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
[[flush-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2014-07-23 15:59:26 -04:00
|
|
|
|
2020-07-02 17:26:49 -04:00
|
|
|
`<target>`::
|
|
|
|
(Optional, string)
|
|
|
|
Comma-separated list of data streams, indices, and index aliases to flush.
|
|
|
|
Wildcard expressions (`*`) are supported.
|
2019-09-30 08:42:52 -04:00
|
|
|
+
|
2020-07-02 17:26:49 -04:00
|
|
|
To flush all data streams and indices in a cluster, omit this parameter or use
|
|
|
|
`_all` or `*`.
|
2014-07-23 15:59:26 -04:00
|
|
|
|
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
[[flush-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
2014-07-23 15:59:26 -04:00
|
|
|
|
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-09-30 08:42:52 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
2019-09-30 08:42:52 -04:00
|
|
|
+
|
|
|
|
Defaults to `open`.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
`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.
|
|
|
|
--
|
|
|
|
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
2019-09-30 08:42:52 -04:00
|
|
|
|
|
|
|
`wait_if_ongoing`::
|
|
|
|
+
|
|
|
|
--
|
|
|
|
(Optional, boolean)
|
|
|
|
If `true`,
|
|
|
|
the flush operation blocks until execution
|
|
|
|
when another flush operation is running.
|
|
|
|
|
|
|
|
|
|
|
|
If `false`,
|
|
|
|
{es} returns an error
|
|
|
|
if you request a flush
|
|
|
|
when another flush operation is running.
|
|
|
|
|
|
|
|
Defaults to `true`.
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
|
|
[[flush-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
|
|
|
|
[[flush-api-specific-ex]]
|
2020-07-02 17:26:49 -04:00
|
|
|
===== Flush a specific data stream or index
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2019-09-30 08:42:52 -04:00
|
|
|
----
|
|
|
|
POST /kimchy/_flush
|
|
|
|
----
|
|
|
|
// TEST[s/^/PUT kimchy\n/]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
|
|
|
|
[[flush-multi-index]]
|
2020-07-02 17:26:49 -04:00
|
|
|
===== Flush several data streams and indices
|
2019-09-30 08:42:52 -04:00
|
|
|
|
|
|
|
[source,console]
|
|
|
|
----
|
|
|
|
POST /kimchy,elasticsearch/_flush
|
|
|
|
----
|
2016-04-29 10:42:03 -04:00
|
|
|
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
|
2015-05-23 10:18:21 -04:00
|
|
|
|
2019-09-04 11:37:00 -04:00
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
[[flush-api-all-ex]]
|
2020-07-02 17:26:49 -04:00
|
|
|
===== Flush all data streams and indices in a cluster
|
2015-05-23 10:18:21 -04:00
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
[source,console]
|
|
|
|
----
|
|
|
|
POST /_flush
|
|
|
|
----
|