Closer is better

Hi !

If I have two documents like:

Doc1: ["title": "A single sheet within a book is a leaf, and each side of a leaf is a page"]
Doc2: ["title" : "A book is a set of sheets of paper and parchment"]

How can I get higher score for the second document when I search for "book" because the word "book" is closer to the beginning of that sentence (title)?

Try to should https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-first-query.html

I don't know if span first query works with my existing query because "Span queries cannot be mixed with non-span queries".

I have not got span_first query work with rescore_query. Any suggestions ?

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