Skip to content

Commit c1ee423

Browse files
SerethiXNils Philipp Schupp
authored and
Nils Philipp Schupp
committed
Add a sorting section to the pinned query
1 parent 21ccde5 commit c1ee423

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/reference/query-dsl/pinned-query.asciidoc

+30
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,33 @@ GET /_search
7878

7979
<1> The document with id `1` from `my-index-000001` will be the first result.
8080
<2> When `_index` is missing, all documents with id `4` from the queried indices will be pinned with the same score.
81+
82+
==== Sorting
83+
84+
The `pinned` query internally uses the calculated relevance to pin the requested documents to the top of the results set.
85+
86+
As soon any sorting is involved, the pinned query will be have no effect.
87+
88+
[source,console]
89+
--------------------------------------------------
90+
POST /_search
91+
{
92+
"sort": [
93+
{
94+
"price": {
95+
"order": "desc"
96+
}
97+
}
98+
],
99+
"query": {
100+
"pinned": {
101+
"ids": [ "1", "4"],
102+
"organic": {
103+
"match": {
104+
"description": "iphone"
105+
}
106+
}
107+
}
108+
}
109+
}
110+
--------------------------------------------------

0 commit comments

Comments
 (0)