Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/reference/query-dsl/pinned-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,33 @@ GET /_search

<1> The document with id `1` from `my-index-000001` will be the first result.
<2> When `_index` is missing, all documents with id `4` from the queried indices will be pinned with the same score.

==== Sorting

The `pinned` query internally uses the calculated relevance to pin the requested documents to the top of the results set.

As soon any sorting is involved, the pinned query will be have no effect.

[source,console]
--------------------------------------------------
POST /_search
{
"sort": [
{
"price": {
"order": "desc"
}
}
],
"query": {
"pinned": {
"ids": [ "1", "4"],
"organic": {
"match": {
"description": "iphone"
}
}
}
}
}
--------------------------------------------------