Update preference.asciidoc
Clarify that `preference` is a query string parameter only and provide an example.
This commit is contained in:
parent
af119dfdd9
commit
b6baa4be4a
|
@ -5,7 +5,7 @@ Controls a `preference` of which shard replicas to execute the search
|
||||||
request on. By default, the operation is randomized between the shard
|
request on. By default, the operation is randomized between the shard
|
||||||
replicas.
|
replicas.
|
||||||
|
|
||||||
The `preference` can be set to:
|
The `preference` is a query string parameter which can be set to:
|
||||||
|
|
||||||
[horizontal]
|
[horizontal]
|
||||||
`_primary`::
|
`_primary`::
|
||||||
|
@ -40,3 +40,20 @@ Custom (string) value::
|
||||||
states. A sample value can be something like the web session id, or the
|
states. A sample value can be something like the web session id, or the
|
||||||
user name.
|
user name.
|
||||||
|
|
||||||
|
For instance, use the user's session ID to ensure consistent ordering of results
|
||||||
|
for the user:
|
||||||
|
|
||||||
|
[source,js]
|
||||||
|
------------------------------------------------
|
||||||
|
curl localhost:9200/_search?preference=xyzabc123 -d '
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"match": {
|
||||||
|
"title": "elasticsearch"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue