Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interval Query should work with Annotated Text Plugin #49289

Closed
bijanfahimi opened this issue Nov 19, 2019 · 2 comments · Fixed by #49555
Closed

Interval Query should work with Annotated Text Plugin #49289

bijanfahimi opened this issue Nov 19, 2019 · 2 comments · Fixed by #49555
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories

Comments

@bijanfahimi
Copy link

Feature Request

elasticsearch version >= 7.4.2

In our use case we would like use the interval query on text fields of type annotated text. The interval query, however, throws an exception:
Can only use interval queries on text fields - not on [text] which is of type [annotated_text]"
The exception is thrown here https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/index/mapper/MappedFieldType.java#L395.

Interval query: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-intervals-query.html.
Annotated Text Plugin: https://www.elastic.co/blog/search-for-things-not-strings-with-the-annotated-text-plugin

@cbuescher cbuescher added :Search/Search Search-related issues that do not fall into other categories >enhancement labels Nov 19, 2019
@elasticmachine
Copy link
Collaborator

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

@cbuescher
Copy link
Member

Maybe @markharwood can comment on whether this field type restriction is there on purpose of if this can and should eventually be supported.

romseygeek added a commit that referenced this issue Nov 26, 2019
The annotated text mapper has a field type that currently extends StringFieldType,
which means that all the positional-related query factory methods need to be copied
over from TextFieldType. In addition, MappedFieldType.intervals() hasn't been
overridden, so you can't use intervals queries with annotated text - a major drawback,
since one of the purposes of annotated text is to be able to run positional queries against
annotations.

This commit changes the annotated text field type to extend TextFieldType instead,
adding tests to ensure that position queries work correctly.

Closes #49289
romseygeek added a commit that referenced this issue Nov 26, 2019
The annotated text mapper has a field type that currently extends StringFieldType,
which means that all the positional-related query factory methods need to be copied
over from TextFieldType. In addition, MappedFieldType.intervals() hasn't been
overridden, so you can't use intervals queries with annotated text - a major drawback,
since one of the purposes of annotated text is to be able to run positional queries against
annotations.

This commit changes the annotated text field type to extend TextFieldType instead,
adding tests to ensure that position queries work correctly.

Closes #49289
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants