Sorting the response JSON

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


Road Types

avenue,ave,boulevard,blvd,circle,cir,court,ct,drive,dr,highway,hwy,lane,ln,loop,lp,parkway,pkwy,place,pl,road,rd,route,rte,street,st,terrace,ter,trail,tr

Multi-unit addresses

apartment,apt,building,bldg,floor,flr,level,lvl,unit

Cardinal Directions

east,e,west,w,north,n,northeast,ne,northwest,nw,south,s,southeast,se,southwest,sw


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.