[Docs] Add to preference parameter docs (#42797)

Adding notes to the existing docs about how using `preference` might increase
request cache utilization but also add warning about the downsides.

Closes #24278
This commit is contained in:
Christoph Büscher 2019-06-04 14:37:55 +02:00
parent 32eae0dfe9
commit d9c582e66b
1 changed files with 10 additions and 2 deletions

View File

@ -6,8 +6,12 @@ default, Elasticsearch selects from the available shard copies in an
unspecified order, taking the <<allocation-awareness,allocation awareness>> and
<<search-adaptive-replica,adaptive replica selection>> configuration into
account. However, it may sometimes be desirable to try and route certain
searches to certain sets of shard copies, for instance to make better use of
per-copy caches.
searches to certain sets of shard copies.
A possible use case would be to make use of per-copy caches like the
<<shard-request-cache,request cache>>. Doing this, however, runs contrary to the
idea of search parallelization and can create hotspots on certain nodes because
the load might not be evenly distributed anymore.
The `preference` is a query string parameter which can be set to:
@ -64,6 +68,10 @@ GET /_search?preference=xyzabc123
------------------------------------------------
// CONSOLE
This can be an effective strategy to increase usage of e.g. the request cache for
unique users running similar searches repeatedly by always hitting the same cache, while
requests of different users are still spread across all shard copies.
NOTE: The `_only_local` preference guarantees only to use shard copies on the
local node, which is sometimes useful for troubleshooting. All other options do
not _fully_ guarantee that any particular shard copies are used in a search,