Using a pinned query (XPACK)
The pinned
query is a special query provided by the X-Pack extension to provide a similar service to Google's promoted results. It's used to return results ranked based on a list of IDs.
Getting ready
You will need an up-and-running Elasticsearch installation, as described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands, any HTTP client can be used, such as curl (https://curl.haxx.se/), postman (https://www.getpostman.com/), or similar. I suggest you use the Kibana console as it provides code completion and better character escaping for Elasticsearch.
To correctly execute the following commands, you will need an index populated with the ch04/populate_kibana.txt
command, which is available in the online code.
How to do it...
To execute the pinned
query, we will perform the following steps:
- To rank the pinned documents, we will provide...