Boost score on token order over proximity

Hello, elastic team.

Is there way to adjust score between proximity and order?

I want to search by "any word in order with some slop".

I found out that most of DSLs that matters with proximity and in order option cannot reach this condition.

Is there any way to access token positions or offsets to adjust score about order and proximity?

Thanks in advance.

The is the intervals query, but I am not sure that will really help in your case. Take a look at Intervals query | Elasticsearch Guide [7.14] | Elastic

Also, you could write your own scripted similarity. See Similarity module | Elasticsearch Guide [7.14] | Elastic - however after taking a quick look, you do not have access to the term position in the scoring formula.

One could come up with different should clauses and different slops for boosint,g but that does not really sound efficient.

Can you share a little more about your use-case and maybe an example where this kind of search makes sense for the user. Maybe there are other possibilities.

What I want to do is choosing whether proximity boosts score or in-order option boosts score.

Query: apple banana carrot
Doc 1: I bought apple, watermelon, kiwi, orange and banana.
Doc 2: I saw banana, but bought apple.

In above case, when user search by example query in option of operator 'OR',
based on other ES DSL doc 2 would get higher score, because token 'banana' and 'apple' are closer. But I want to doc 1 to get higher because token 'banana' and 'apple' are in order.

Is it possible to create in-order query with operator 'OR'?

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