IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Pinned Query Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Pinned Query Usage
editPromotes 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 _id field. See the Elasticsearch documentation on pinned query for more details.
Fluent DSL example
editq
.Pinned(c => c
.Name("named_query")
.Boost(1.1)
.Organic(qq => qq.MatchAll(m => m.Name("organic_query")))
.Ids(1, 11, 22)
)
Object Initializer syntax example
editnew PinnedQuery()
{
Name = "named_query",
Boost = 1.1,
Organic = new MatchAllQuery { Name = "organic_query" },
Ids = new Id[] { 1,11,22 },
}
Example json output.
{
"pinned": {
"_name": "named_query",
"boost": 1.1,
"organic": {
"match_all": {
"_name": "organic_query"
}
},
"ids": [
1,
11,
22
]
}
}