Sorting by Geo Distance with Relevance Score

Hello everyone, I want to sort results according to relevance score and geo distance together. What is the best way to do so?

I think this query does the trick:

Thank you for the message. Actually I want to do it at sorting. I mean that I don't want to geo distance effect the returned list, only effect the sorting of the list together with relevance score. (I have used sort but it didn't pay attention to relevance score.)

Anyone have any ideas?

Can I use _score inside sort script?

You need to provide an example, it is not clear to me what you are trying to do.

I want to sort results according to relevance score and geo distance together. What is the best way to do so?

Example:

Data-1:
Job Title: Waitress (Boost:100)
Similar Jobs: Busboy (Boost:10)
Lat Lon: [45, 62]

Data-2:
Job Title: Busboy (Boost:100)
Similar Jobs: Waitress (Boost:10)
Lat Lon: [45, 64]

Data-3:
Job Title: Doctor (Boost:100)
Similar Jobs: Nurse (Boost:10)
Lat Lon: [45 66]

When I search for
Waitress (in Job Title and Similar Jobs fields) - Geo Location: [45, 66]

I want to sort the results together with Score and geo location. If the difference between Geo location is not big, I want Data-1 to be sorted first because it is relevancy score higher. When I used "Distance feature query", new irrevelant documents (doctor-Data3) were returned because of they are closer to searched geo location, even boost did not help me.

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