One of the nice features of ElasticSearch is the support for Pinned Queries. With Pinned Queries you can promote a set of documents to rank higher than those matching a given query. This is a nice feature if you want to put specific results into the spotlight (for example if you want to promote a specific product or article).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q | |
.Pinned(c => c | |
.Name("shoesforsale") | |
.Boost(1.1) | |
.Organic(qq => qq.MatchAll(m => m.Name("brown shoes"))) | |
.Ids(1, 11, 22) | |
) |
In the organic part you can specify what the query is you want to execute. The Ids part will return the specified documents and put them on top of the search results.
More info: https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl-pinned-query.html