I have an Elasticsearch index that contains documents with company
and subscription
fields. The subscription
field can have values like platinum
, silver
, and gold
.
For every search by company name, I need to retrieve results in the following format:
- 10 results per page
- 5 companies with a
platinum
subscription - 3 companies with a
silver
subscription - 2 companies with a
gold
subscription
- 5 companies with a
How can I achieve this in Elasticsearch? Is there a way to structure the query and pagination to meet these requirements?