Sort by country with one specific country first

Hello,
I am new to Elastic and I am trying to get a list of products. My bool query works in general but now i want to solve the following sorting problem.

The multilanguage website shows products of different countries.
The list should first show the products of the country of the user and after that the rest of the products, ordered by country. Is that possible to realize without two separated queries?

In my query the sorting looks like this at the moment (PHP)
image

Can somebody please help me or just give me a hint if it is possible or not?

https://www.elastic.co/guide/en/elasticsearch/reference/7.9/query-dsl-pinned-query.html might do what you want.

Otherwise you may be able to craft a query with a boost on the user's country value.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.