Dynamic price sorting and filtering

This is the scenario:

Imagine that a register user creates a new entity with the price: 1 | currency: EUR and other registered user creates a new entity with price: 1 | currency: USD and so on...

What I'm trying to do is sort by price the records depending on the currency selected by the frontend user (EUR or USD).

So you want to filter all the prices to show only EUR or USD and then sort by its value?

actual requirement is show all these prices in INR currency I have seperately a matrix for converstion rates

What you could do is to compute at index time another field for INR currency but the problem is that you will need to update your prices everyday I guess.

You can use that https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_script_based_sorting

But if you are returning all your catalog (match_all) that can be slow I guess.

1 Like

@dadoonet I will try in this way, Thank you.

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