2013-08-28 19:24:34 -04:00
|
|
|
[[indices-flush]]
|
2019-09-30 08:42:52 -04:00
|
|
|
=== Flush API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Flush</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
Flushes one or more indices.
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST /twitter/_flush
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[setup:twitter]
|
|
|
|
|
|
|
|
|
|
|
|
[[flush-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
2019-11-27 09:26:57 -05:00
|
|
|
`POST /<index>/_flush`
|
2019-09-30 08:42:52 -04:00
|
|
|
|
2019-11-27 09:26:57 -05:00
|
|
|
`GET /<index>/_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
|
|
|
|
2019-09-04 11:37:00 -04:00
|
|
|
Flushing an index is the process of making sure that any data that is currently
|
|
|
|
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
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
|
|
|
|
+
|
|
|
|
To flush all indices,
|
|
|
|
omit this parameter
|
|
|
|
or use a value of `_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
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
include::{docdir}/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
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
|
|
|
+
|
|
|
|
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.
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
|
|
|
|
|
|
|
`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]]
|
|
|
|
===== Flush a specific 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]]
|
|
|
|
===== Flush several indices
|
|
|
|
|
|
|
|
[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]]
|
|
|
|
===== Flush all indices
|
2015-05-23 10:18:21 -04:00
|
|
|
|
2019-09-30 08:42:52 -04:00
|
|
|
[source,console]
|
|
|
|
----
|
|
|
|
POST /_flush
|
|
|
|
----
|