2013-08-28 19:24:34 -04:00
|
|
|
[[indices-flush]]
|
2019-07-19 14:35:36 -04:00
|
|
|
=== Flush
|
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-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-04-29 10:42:03 -04:00
|
|
|
POST twitter/_flush
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-04-29 10:42:03 -04:00
|
|
|
// TEST[setup:twitter]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[float]
|
2014-07-23 15:59:26 -04:00
|
|
|
[[flush-parameters]]
|
2019-07-19 14:35:36 -04:00
|
|
|
==== Request Parameters
|
2014-07-23 15:59:26 -04:00
|
|
|
|
|
|
|
The flush API accepts the following request parameters:
|
|
|
|
|
|
|
|
[horizontal]
|
2019-09-04 11:37:00 -04:00
|
|
|
`wait_if_ongoing`:: If set to `true` the flush operation will block until the
|
|
|
|
flush can be executed if another flush operation is already executing. If set to
|
|
|
|
`false` then an exception will be thrown on the shard level if another flush
|
|
|
|
operation is already running. Defaults to `true`.
|
2014-07-23 15:59:26 -04:00
|
|
|
|
2019-09-04 11:37:00 -04:00
|
|
|
`force`:: Whether a flush should be forced even if it is not necessarily needed
|
|
|
|
i.e. if no changes will be committed to the index. This can be used to force
|
|
|
|
the generation number of the transaction log to be incremented even if no
|
|
|
|
uncommitted changes are present. This parameter should be considered internal.
|
2014-07-23 15:59:26 -04:00
|
|
|
|
|
|
|
[float]
|
|
|
|
[[flush-multi-index]]
|
2019-07-19 14:35:36 -04:00
|
|
|
==== Multi Index
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-04 11:37:00 -04:00
|
|
|
The flush API can be applied to more than one index with a single call, or even
|
|
|
|
on `_all` the indices.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-04-29 10:42:03 -04:00
|
|
|
POST kimchy,elasticsearch/_flush
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-04-29 10:42:03 -04:00
|
|
|
POST _flush
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
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
|
|
|
|
2015-05-23 10:18:21 -04:00
|
|
|
[float]
|
2019-09-19 08:22:37 -04:00
|
|
|
[[synced-flush-api]]
|
|
|
|
==== Synced Flush
|
2015-05-23 10:18:21 -04:00
|
|
|
|
2019-09-19 08:22:37 -04:00
|
|
|
See <<indices-synced-flush-api>>.
|