Skip to content

Commit 4389db9

Browse files
authored
[DOCS] Reformat refresh API docs (#46667) (#47591)
1 parent 9bf8f33 commit 4389db9

File tree

3 files changed

+94
-18
lines changed

3 files changed

+94
-18
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

docs/reference/indices/refresh.asciidoc

Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,106 @@
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

109
[source,js]
11-
--------------------------------------------------
10+
----
1211
POST /twitter/_refresh
13-
--------------------------------------------------
12+
----
1413
// CONSOLE
1514
// TEST[setup:twitter]
1615

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

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

2391
[source,js]
24-
--------------------------------------------------
92+
----
2593
POST /kimchy,elasticsearch/_refresh
94+
----
95+
// CONSOLE
96+
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
97+
2698

99+
[[refresh-api-all-ex]]
100+
===== Refresh all indices
101+
102+
[source,js]
103+
----
27104
POST /_refresh
28-
--------------------------------------------------
105+
----
29106
// CONSOLE
30-
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]

0 commit comments

Comments
 (0)