11[[indices-flush]]
2- === Flush
2+ === Flush API
3+ ++++
4+ <titleabbrev>Flush</titleabbrev>
5+ ++++
6+
7+ Flushes one or more indices.
8+
9+ [source,js]
10+ --------------------------------------------------
11+ POST /twitter/_flush
12+ --------------------------------------------------
13+ // CONSOLE
14+ // TEST[setup:twitter]
15+
16+
17+ [[flush-api-request]]
18+ ==== {api-request-title}
19+
20+ `POST /<index>/flush`
21+
22+ `GET /<index>/flush`
23+
24+ `POST /flush`
25+
26+ `GET /flush`
27+
28+
29+ [[flush-api-desc]]
30+ ==== {api-description-title}
331
432The flush API allows to flush one or more indices through an API. The
533flush process of an index makes sure that any data that is currently only
@@ -9,47 +37,93 @@ reindexed from the transaction logs after the Lucene indexed is opened. By
937default, Elasticsearch uses heuristics in order to automatically
1038trigger flushes as required. It is rare for users to need to call the API directly.
1139
12- [source,js]
13- --------------------------------------------------
14- POST twitter/_flush
15- --------------------------------------------------
16- // CONSOLE
17- // TEST[setup:twitter]
1840
19- [float]
20- [[flush-parameters]]
21- ==== Request Parameters
41+ [[flush-api-path-params]]
42+ ==== {api-path-parms-title}
2243
23- The flush API accepts the following request parameters:
44+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
45+ +
46+ To flush all indices,
47+ omit this parameter
48+ or use a value of `_all` or `*`.
2449
25- [horizontal]
26- `wait_if_ongoing`:: If set to `true`(the default value) the flush operation will
27- block until the flush can be executed if another flush operation is already executing.
2850
29- `force`:: Whether a flush should be forced even if it is not necessarily needed i.e.
30- if no changes will be committed to the index. This is useful if transaction log IDs
31- should be incremented even if no uncommitted changes are present.
32- (This setting can be considered as internal)
51+ [[flush-api-query-params]]
52+ ==== {api-query-parms-title}
3353
34- [float]
35- [[flush-multi-index]]
36- ==== Multi Index
54+ include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
55+
56+ include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
57+ +
58+ Defaults to `open`.
3759
38- The flush API can be applied to more than one index with a single call,
39- or even on `_all` the indices.
60+ `force`::
61+ +
62+ --
63+ (Optional, boolean)
64+ If `true`,
65+ the request forces a flush
66+ even if there are no changes to commit to the index.
67+ Defaults to `true`.
68+
69+ You can use this parameter
70+ to increment the generation number of the transaction log.
71+
72+ This parameter is considered internal.
73+ --
74+
75+
76+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
77+
78+ `wait_if_ongoing`::
79+ +
80+ --
81+ (Optional, boolean)
82+ If `true`,
83+ the flush operation blocks until execution
84+ when another flush operation is running.
85+
86+
87+ If `false`,
88+ {es} returns an error
89+ if you request a flush
90+ when another flush operation is running.
91+
92+ Defaults to `true`.
93+ --
94+
95+
96+ [[flush-api-example]]
97+ ==== {api-examples-title}
98+
99+
100+ [[flush-api-specific-ex]]
101+ ===== Flush a specific index
40102
41103[source,js]
42- --------------------------------------------------
43- POST kimchy,elasticsearch/_flush
104+ ----
105+ POST /kimchy/_flush
106+ ----
107+ // CONSOLE
108+ // TEST[s/^/PUT kimchy\n/]
44109
45- POST _flush
46- --------------------------------------------------
110+
111+ [[flush-multi-index]]
112+ ===== Flush several indices
113+
114+ [source,js]
115+ ----
116+ POST /kimchy,elasticsearch/_flush
117+ ----
47118// CONSOLE
48119// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
49120
50121
51- [float]
52- [[synced-flush-api]]
53- ==== Synced Flush
122+ [[flush-api-all-ex]]
123+ ===== Flush all indices
54124
55- See <<indices-synced-flush-api>>.
125+ [source,js]
126+ ----
127+ POST /_flush
128+ ----
129+ // CONSOLE
0 commit comments