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
platinumsubscription - 3 companies with a
silversubscription - 2 companies with a
goldsubscription
- 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?