Elasticsearch: Fuzziness support in intervals query

Created on 26 Nov 2019  路  9Comments  路  Source: elastic/elasticsearch

Feature request:

Following up on this discussion:

ES 7.0 introduced support for the Lucene intervals query which is more powerful and easier to deal with than span queries (analyzer support, etc). However, one thing that span queries support and intervals doesn't is fuzziness. Since the intervals query is supposed to help in legal and patent search, I have a hard time understanding how this could be possible without fuzziness support.

I could not find much information about that when browsing the Github issues. Is there any reason why the intervals query doesn't support fuzziness? (because Lucene doesn't maybe)? Is it on the roadmap?

Quoting @jimczi who suggested to open a new issue so that this new feature request could be discussed:

I think it's worth opening an issue in Elasticsearch and we'll discuss where the support should land (Elasticsearch or Lucene). As @Mikhail_Khludnev suggested it should be easy to make fuzzy intervals in Elasticsearch using the MultiTermIntervalsSource except that it is not exposed :wink:. Queries that need to check positions cannot handle large number of multi-terms so we have some logic to restrict to those that expand to less than a provided threshold (bounded to 1024). With this protection in place I don't see why we should not expose them more simply in Lucene.

The floor is yours, guys!

:SearcSearch >feature

Most helpful comment

This is one of the reasons I created #49519. Even if this is not something you (Elastic) want to maintain and/or put restrictions on, please allow us to do it our self via plugins.

All 9 comments

This is one of the reasons I created #49519. Even if this is not something you (Elastic) want to maintain and/or put restrictions on, please allow us to do it our self via plugins.

Pinging @elastic/es-search (:Search/Search)

If we have the same restriction than prefix and wildcard on intervals (we throw an error if the maximum number of expansions is reached) I don't see why we could not have the support in core. @romseygeek what do you think ?

Fuzziness is slightly trickier than prefix or wildcard because we don't just select the first n matching terms from the index, we also rank them by how close they are to the original term, so I think this may require some work in lucene as well. But +1 to adding it to core, it will be a generally useful thing to support.

Fuzziness is slightly trickier than prefix or wildcard because we don't just select the first n matching terms from the index

The current strategy for multi-terms interval query is to throw an error if the number of expanded terms is greater than the provided threshold. I think we should apply the same for fuzzy query in order to ensure that we don't miss result due to pruning ?

This is one of the reasons I created #49519. Even if this is not something you (Elastic) want to maintain and/or put restrictions on, please allow us to do it our self via plugins.

Good to see you @mattweber. Have you developed any such plugin that is publically available?

@prasad2kin Hi! No, I have not because intervals are not currently pluggable. I opened #49519 to make it possible, but I am not sure this will get merged or not.

Thanks @romseygeek !!
Any idea when this will get merged and in which release?

@consulthys you can check the version in the pr, it is currently targeted for 7.6.

Was this page helpful?
0 / 5 - 0 ratings