11[[indices-flush]]
2- === Flush
2+ === Flush API
3+ ++++
4+ <titleabbrev>Flush</titleabbrev>
5+ ++++
6+
7+ Flushes one or more indices.
8+
9+ [source,console]
10+ --------------------------------------------------
11+ POST /twitter/_flush
12+ --------------------------------------------------
13+ // TEST[setup:twitter]
14+
15+
16+ [[flush-api-request]]
17+ ==== {api-request-title}
18+
19+ `POST /<index>/flush`
20+
21+ `GET /<index>/flush`
22+
23+ `POST /flush`
24+
25+ `GET /flush`
26+
27+
28+ [[flush-api-desc]]
29+ ==== {api-description-title}
330
431Flushing an index is the process of making sure that any data that is currently
532only stored in the <<index-modules-translog,transaction log>> is also
@@ -22,47 +49,90 @@ call the flush API after indexing some documents then a successful response
2249indicates that {es} has flushed all the documents that were indexed before the
2350flush API was called.
2451
25- [source,console]
26- --------------------------------------------------
27- POST twitter/_flush
28- --------------------------------------------------
29- // TEST[setup:twitter]
3052
31- [float]
32- [[flush-parameters]]
33- ==== Request Parameters
53+ [[flush-api-path-params]]
54+ ==== {api-path-parms-title}
3455
35- The flush API accepts the following request parameters:
56+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
57+ +
58+ To flush all indices,
59+ omit this parameter
60+ or use a value of `_all` or `*`.
3661
37- [horizontal]
38- `wait_if_ongoing`:: If set to `true` the flush operation will block until the
39- flush can be executed if another flush operation is already executing. If set to
40- `false` then an exception will be thrown on the shard level if another flush
41- operation is already running. Defaults to `true`.
4262
43- `force`:: Whether a flush should be forced even if it is not necessarily needed
44- i.e. if no changes will be committed to the index. This can be used to force
45- the generation number of the transaction log to be incremented even if no
46- uncommitted changes are present. This parameter should be considered internal.
63+ [[flush-api-query-params]]
64+ ==== {api-query-parms-title}
4765
48- [float]
49- [[flush-multi-index]]
50- ==== Multi Index
66+ include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
67+
68+ include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
69+ +
70+ Defaults to `open`.
5171
52- The flush API can be applied to more than one index with a single call, or even
53- on `_all` the indices.
72+ `force`::
73+ +
74+ --
75+ (Optional, boolean)
76+ If `true`,
77+ the request forces a flush
78+ even if there are no changes to commit to the index.
79+ Defaults to `true`.
80+
81+ You can use this parameter
82+ to increment the generation number of the transaction log.
83+
84+ This parameter is considered internal.
85+ --
86+
87+
88+ include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
89+
90+ `wait_if_ongoing`::
91+ +
92+ --
93+ (Optional, boolean)
94+ If `true`,
95+ the flush operation blocks until execution
96+ when another flush operation is running.
97+
98+
99+ If `false`,
100+ {es} returns an error
101+ if you request a flush
102+ when another flush operation is running.
103+
104+ Defaults to `true`.
105+ --
106+
107+
108+ [[flush-api-example]]
109+ ==== {api-examples-title}
110+
111+
112+ [[flush-api-specific-ex]]
113+ ===== Flush a specific index
54114
55115[source,console]
56- --------------------------------------------------
57- POST kimchy,elasticsearch/_flush
116+ ----
117+ POST /kimchy/_flush
118+ ----
119+ // TEST[s/^/PUT kimchy\n/]
58120
59- POST _flush
60- --------------------------------------------------
121+
122+ [[flush-multi-index]]
123+ ===== Flush several indices
124+
125+ [source,console]
126+ ----
127+ POST /kimchy,elasticsearch/_flush
128+ ----
61129// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
62130
63131
64- [float]
65- [[synced-flush-api]]
66- ==== Synced Flush
132+ [[flush-api-all-ex]]
133+ ===== Flush all indices
67134
68- See <<indices-synced-flush-api>>.
135+ [source,console]
136+ ----
137+ POST /_flush
138+ ----
0 commit comments