Rank and sort results of range query?

As far as I can tell, all docs with a range field overlapped by a query range with the default INTERSECTS operator are returned with a score of 1. However, I would like to rank results by the extent of that intersection/overlap. So that for example, a query with the range{"gte":100,"lte":200}, a document with a range {"gte":110,"lte":200} would score higher than one with a range {"gte":190,"lte":400}

Is this possible? Using ES 6.6 btw

Unfortunately, there is not way to apply custom scoring to range queries. As you correctly noticed, they all produce a constant score equal to boost value, which is 1 by default.

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