Ordering results by terms filter


(Jonsgreen) #1

I am relatively new to elasticsearch. I am doing a simple filter query by terms using ids:

{ filter: { terms: { id: [3, 5, 8] } } }

However, the results do not come sorted by the order of the values. Is there a simple way to achieve this within elasticsearch?


(Ivan Brusic) #2

Filters do not contribute to the ordering of the results. Is there a query
as well?

If you want to sort based on the arbitrary contents of an array, it might
be possible with a script. But that would be a hack. I would focus on
achieving proper scoring with queries.

Ivan


(system) #3