Scoring Elasticsearch by postion of query term in the indexed document

I mean if I have When I index say following documents :

doc 1: coconut red orange
doc 2: orange coconut apple
doc 3: coconut orange apple

I search for a term "coconut" and get I following result:

rank 1: coconut red orange
rank 2: orange coconut apple
rank 3: coconut orange apple

All the docs have same score.

My disered output would have been :

coconut red orange
coconut orange apple
orange coconut apple

The term which I am searching for is at the start of the document needs to be ranked better than where it appears later.

I can't figure out how to make that happen. Term position isn't factored into the default scoring logic, and I can't find a way to get it in there. Seems like a simple enough issue though that others must have run into this before. Has anyone figured it out yet?

Thanks!

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