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

Exists query fail on text field with sub-fields option #64585

Closed
jimczi opened this issue Nov 4, 2020 · 2 comments · Fixed by #64597
Closed

Exists query fail on text field with sub-fields option #64585

jimczi opened this issue Nov 4, 2020 · 2 comments · Fixed by #64597
Assignees
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@jimczi
Copy link
Contributor

jimczi commented Nov 4, 2020

Elasticsearch version (bin/elasticsearch --version):

7.9.2

Plugins installed: []

Description of the problem including expected versus actual behavior:

Text fields that activate index_prefixes or index_phrases break exists query that targets
the parent object. So currently if a field foo.bar is defined as a text field with index_prefixes option,
any exists query on foo throws an UOE:

org.elasticsearch.index.mapper.TextFieldMapper$PrefixFieldType.existsQuery(TextFieldMapper.java:488)
  at org.elasticsearch.index.query.ExistsQueryBuilder.newObjectFieldExistsQuery(ExistsQueryBuilder.java:214)
  at org.elasticsearch.index.query.ExistsQueryBuilder.newFieldExistsQuery(ExistsQueryBuilder.java:202)
  at org.elasticsearch.index.query.ExistsQueryBuilder.newFilter(ExistsQueryBuilder.java:164)
  at org.elasticsearch.index.search.QueryStringQueryParser.existsQuery(QueryStringQueryParser.java:636)
  at org.elasticsearch.index.search.QueryStringQueryParser.getWildcardQuery(QueryStringQueryParser.java:647) 

Steps to reproduce:

PUT test
{
    "mappings": {
        "properties": {
            "foo": {
                "properties": {
                    "bar": {
                        "type": "text",
                        "index_prefixes": {}
                    }
                }
            }
        }
    }
}

POST test/_doc
{
  "foo.bar": "1"
}

POST test/_search?q=foo:*

Relates #63446

@jimczi jimczi added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types labels Nov 4, 2020
@elasticmachine
Copy link
Collaborator

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

@jimczi
Copy link
Contributor Author

jimczi commented Nov 9, 2020

Fixed by #64597

@jimczi jimczi closed this as completed Nov 9, 2020
@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants