Sorting the response JSON

I'm using the below synonyms in my elasticsearch index.

Road Types


Multi-unit addresses


Cardinal Directions


While passing the input to query as a match_phrase_prefix, even if I'm passing it as "southeast" I'm getting "southwest" first in JSON followed by southeast and other directions. How do I sort it in order to get the direction that is passed as query first.

Welcome to our community! :smiley:

Elasticsearch will not retain any sorting like that internally as the JSON standard doesn't require it.

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