Skip to content

Commit cc0502f

Browse files
authored
[DOCS] Reformat refresh API docs (#46667) (#47590)
1 parent c5a5243 commit cc0502f

File tree

3 files changed

+95
-22
lines changed

3 files changed

+95
-22
lines changed

docs/reference/how-to/indexing-speed.asciidoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ The operation that consists of making changes visible to search - called a
4343
<<indices-refresh,refresh>> - is costly, and calling it often while there is
4444
ongoing indexing activity can hurt indexing speed.
4545

46-
By default, Elasticsearch runs this operation every second, but only on
47-
indices that have received one search request or more in the last 30 seconds.
46+
include::{docdir}/indices/refresh.asciidoc[tag=refresh-interval-default]
4847
This is the optimal configuration if you have no or very little search traffic
4948
(e.g. less than one search request every 5 minutes) and want to optimize for
5049
indexing speed. This behavior aims to automatically optimize bulk indexing in
@@ -55,7 +54,7 @@ On the other hand, if your index experiences regular search requests, this
5554
default behavior means that Elasticsearch will refresh your index every 1
5655
second. If you can afford to increase the amount of time between when a document
5756
gets indexed and when it becomes visible, increasing the
58-
<<dynamic-index-settings,`index.refresh_interval`>> to a larger value, e.g.
57+
<<index-refresh-interval-setting,`index.refresh_interval`>> to a larger value, e.g.
5958
`30s`, might help improve indexing speed.
6059

6160
[float]

docs/reference/index-modules.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ specific index module:
106106
How long a shard can not receive a search or get request until it's considered
107107
search idle. (default is `30s`)
108108

109+
[[index-refresh-interval-setting]]
109110
`index.refresh_interval`::
110111

111112
How often to perform a refresh operation, which makes recent changes to the
Lines changed: 92 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,103 @@
11
[[indices-refresh]]
2-
=== Refresh
2+
=== Refresh API
3+
++++
4+
<titleabbrev>Refresh</titleabbrev>
5+
++++
36

4-
The refresh API allows to explicitly refresh one or more index, making
5-
all operations performed since the last refresh available for search.
6-
The (near) real-time capabilities depend on the index engine used. For
7-
example, the internal one requires refresh to be called, but by default a
8-
refresh is scheduled periodically.
7+
Refreshes one or more indices.
98

10-
[source,js]
11-
--------------------------------------------------
9+
[source,console]
10+
----
1211
POST /twitter/_refresh
13-
--------------------------------------------------
14-
// CONSOLE
12+
----
1513
// TEST[setup:twitter]
1614

17-
[float]
18-
==== Multi Index
1915

20-
The refresh API can be applied to more than one index with a single
21-
call, or even on `_all` the indices.
16+
[[refresh-api-request]]
17+
==== {api-request-title}
2218

23-
[source,js]
24-
--------------------------------------------------
19+
`POST <index>/_refresh`
20+
21+
`GET <index>/_refresh`
22+
23+
`POST /_refresh`
24+
25+
`GET /_refresh`
26+
27+
28+
[[refresh-api-desc]]
29+
==== {api-description-title}
30+
31+
Use the refresh API to explicitly refresh one or more indices.
32+
A _refresh_ makes all operations performed on an index
33+
since the last refresh
34+
available for search.
35+
36+
// tag::refresh-interval-default[]
37+
By default, Elasticsearch periodically refreshes indices every second, but only on
38+
indices that have received one search request or more in the last 30 seconds.
39+
// end::refresh-interval-default[]
40+
You can change this default interval
41+
using the <<index-refresh-interval-setting,`index.refresh_interval`>> setting.
42+
43+
[IMPORTANT]
44+
====
45+
Refreshes are a resource-intensive.
46+
To ensure good cluster performance,
47+
we recommend waiting for {es}'s periodic refresh
48+
rather than performing an explicit refresh
49+
when possible.
50+
51+
If your application workflow
52+
indexes documents and then runs a search
53+
to retrieve the indexed document,
54+
we recommend using the <<docs-index_,index API>>'s
55+
`refresh=wait_for` query parameter option.
56+
This option ensures the indexing operation waits
57+
for a periodic refresh
58+
before running the search.
59+
====
60+
61+
[[refresh-api-path-params]]
62+
==== {api-path-parms-title}
63+
64+
include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
65+
+
66+
To refresh all indices in the cluster,
67+
omit this parameter
68+
or use a value of `_all` or `*`.
69+
70+
71+
[[refresh-api-query-params]]
72+
==== {api-query-parms-title}
73+
74+
include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
75+
76+
include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
77+
+
78+
Defaults to `open`.
79+
80+
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
81+
82+
83+
[[refresh-api-example]]
84+
==== {api-examples-title}
85+
86+
87+
[[refresh-api-multiple-ex]]
88+
===== Refresh several indices
89+
90+
[source,console]
91+
----
2592
POST /kimchy,elasticsearch/_refresh
93+
----
94+
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
2695

96+
97+
[[refresh-api-all-ex]]
98+
===== Refresh all indices
99+
100+
[source,console]
101+
----
27102
POST /_refresh
28-
--------------------------------------------------
29-
// CONSOLE
30-
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
103+
----

0 commit comments

Comments
 (0)