Skip to content

Commit cae2225

Browse files
committed
Review feedback
1 parent e297457 commit cae2225

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

docs/reference/search/request/preference.asciidoc

+34-29
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,29 @@ account. However, it may sometimes be desirable to try and route certain
99
searches to certain sets of shard copies, for instance to make better use of
1010
per-copy caches.
1111

12-
Preferences do not _guarantee_ that any particular shard copies are used in a
13-
search, and on a changing index this may mean that repeated searches may yield
14-
different results if they are executed on different shard copies which are in
15-
different refresh states.
16-
1712
The `preference` is a query string parameter which can be set to:
1813

1914
[horizontal]
2015
`_primary`::
21-
The operation will be executed only on primary shards.
22-
deprecated[6.1.0, will be removed in 7.0, use `_only_nodes` or
23-
`_prefer_nodes`]
16+
The operation will be executed only on primary shards. deprecated[6.1.0,
17+
will be removed in 7.0. See the warning below for more information.]
2418

2519
`_primary_first`::
26-
The operation will be executed on primary shards if possible, but will
27-
fall back to other shards if not. deprecated[6.1.0, will be removed in
28-
7.0, use `_only_nodes` or `_prefer_nodes`]
20+
The operation will be executed on primary shards if possible, but will fall
21+
back to other shards if not. deprecated[6.1.0, will be removed in 7.0. See
22+
the warning below for more information.]
2923

3024
`_replica`::
31-
The operation will be executed only on replica shards. If there are
32-
multiple replicas then the order of preference between them is
33-
unspecified. deprecated[6.1.0, will be removed in 7.0, use
34-
`_only_nodes` or `_prefer_nodes`]
25+
The operation will be executed only on replica shards. If there are multiple
26+
replicas then the order of preference between them is unspecified.
27+
deprecated[6.1.0, will be removed in 7.0. See the warning below for more
28+
information.]
3529

3630
`_replica_first`::
37-
The operation will be executed on replica shards if possible, but will
38-
fall back to other shards if not. If there are multiple replicas then
39-
the order of preference between them is unspecified. deprecated[6.1.0,
40-
will be removed in 7.0, use `_only_nodes` or `_prefer_nodes`]
31+
The operation will be executed on replica shards if possible, but will fall
32+
back to other shards if not. If there are multiple replicas then the order of
33+
preference between them is unspecified. deprecated[6.1.0, will be removed in
34+
7.0. See the warning below for more information.]
4135

4236
`_only_local`::
4337
The operation will be executed only on shards allocated to the local
@@ -72,8 +66,9 @@ Custom (string) value::
7266
each time: the cluster state, and therefore the selected shards, may change
7367
for a number of reasons including shard relocations and shard failures, and
7468
nodes may sometimes reject searches causing fallbacks to alternative nodes.
75-
A good candidate for a custom preference value is something like the web
76-
session id or the user name.
69+
However, in practice the ordering of shards tends to remain stable for long
70+
periods of time. A good candidate for a custom preference value is something
71+
like the web session id or the user name.
7772

7873
For instance, use the user's session ID `xyzabc123` as follows:
7974

@@ -90,12 +85,22 @@ GET /_search?preference=xyzabc123
9085
------------------------------------------------
9186
// CONSOLE
9287

88+
NOTE: The `_only_local` preference guarantees only to use shard copies on the
89+
local node, which is sometimes useful for troubleshooting. All other options do
90+
not _fully_ guarantee that any particular shard copies are used in a search,
91+
and on a changing index this may mean that repeated searches may yield
92+
different results if they are executed on different shard copies which are in
93+
different refresh states.
94+
9395
WARNING: The `_primary`, `_primary_first`, `_replica` and `_replica_first` are
94-
not recommended, and will be removed in a future version. They do not help to
95-
avoid inconsistent results that arise from the use of shards that have
96-
different refresh states, and Elasticsearch uses synchronous replication so the
97-
primary does not in general hold fresher data than its replicas. The
98-
`_primary_first` and `_replica_first` preferences silently fall back to
99-
non-preferred copies if it is not possible to search the preferred copies. The
100-
`_primary` and `_replica` preferences will silently change their preferred
101-
shards if a replica is promoted to primary, which can happen at any time.
96+
deprecated as their use is not recommended. They do not help to avoid
97+
inconsistent results that arise from the use of shards that have different
98+
refresh states, and Elasticsearch uses synchronous replication so the primary
99+
does not in general hold fresher data than its replicas. The `_primary_first`
100+
and `_replica_first` preferences silently fall back to non-preferred copies if
101+
it is not possible to search the preferred copies. The `_primary` and
102+
`_replica` preferences will silently change their preferred shards if a replica
103+
is promoted to primary, which can happen at any time. The `_primary` preference
104+
can also put undesirable extra load on the primary shards. The cache-related
105+
benefits of these options can also be obtained using `_only_nodes`,
106+
`_prefer_nodes`, or a custom string value instead.

0 commit comments

Comments
 (0)