mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 21:18:31 +00:00
* Search enhancement: pinned queries (#44345) Search enhancement: - new query type allows selected documents to be promoted above any "organic” search results. This is the first feature in a new module `search-business-rules` which will house licensed (non OSS) logic for rewriting queries according to business rules. The PinnedQueryBuilder class offers a new `pinned` query in the DSL that takes an array of promoted IDs and an “organic” query and ensures the documents with the promoted IDs rank higher than the organic matches. Closes #44074
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
[role="xpack"]
|
|
[testenv="basic"]
|
|
[[query-dsl-pinned-query]]
|
|
=== Pinned Query
|
|
Promotes selected documents to rank higher than those matching a given query.
|
|
This feature is typically used to guide searchers to curated documents that are
|
|
promoted over and above any "organic" matches for a search.
|
|
The promoted or "pinned" documents are identified using the document IDs stored in
|
|
the <<mapping-id-field,`_id`>> field.
|
|
|
|
==== Example request
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET /_search
|
|
{
|
|
"query": {
|
|
"pinned" : {
|
|
"ids" : ["1", "4", "100"],
|
|
"organic" : {
|
|
"match":{
|
|
"description": "iphone"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// CONSOLE
|
|
|
|
[[pinned-query-top-level-parameters]]
|
|
==== Top-level parameters for `pinned`
|
|
|
|
`ids`::
|
|
An array of <<mapping-id-field, document IDs>> listed in the order they are to appear in results.
|
|
`organic`::
|
|
Any choice of query used to rank documents which will be ranked below the "pinned" document ids. |