New to Elasticsearch? Join our getting started with Elasticsearch webinar. You can also start a free cloud trial or try Elastic on your machine now.
A search engine’s job is to return relevant results. However, there are business needs that go beyond that,–like highlighting sales, prioritizing seasonal products, or showcasing sponsored items—and developers cannot always do this in the search query.
In addition, these use cases are usually time-sensitive, and going through the typical development stages (creating a code branch and then waiting for a new release) is a time-consuming process.
So, what if we could do this whole process with just an API call, or better yet, with just a few clicks in Kibana?
Query Rules UI
Elasticsearch 8.10 introduced Query Rules and Rule Retriever. These are tools designed to inject pinned results into the queries without impacting the organic results’ ranking based on rules. They only add business logic on top of the results in a declarative and simple way.
Some common use cases for Query Rules are:
- Highlighting promoted listings or sales: Showing on-sale or sponsored items on top.
- Excluding by context or geolocation: Hiding certain items when local regulations don’t allow you to show them.
- Prioritizing key results: Making sure popular or fixed searches are always on top, regardless of the organic ranking.
To access the interface and interact with these tools, you need to click on the Kibana side menu and go to Query Rules, under Relevance: