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 queries can fail on search_as_you_type fields. #64609

Closed
jtibshirani opened this issue Nov 4, 2020 · 1 comment · Fixed by #64630
Closed

Exists queries can fail on search_as_you_type fields. #64609

jtibshirani opened this issue Nov 4, 2020 · 1 comment · Fixed by #64630
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@jtibshirani
Copy link
Contributor

When a search_as_you_type field is nested under an object, then exists queries on the object field will fail:

PUT test
{
    "mappings": {
        "properties": {
            "object": {
                "properties": {
                    "field": {
                        "type": "search_as_you_type"
                    }
                }
            }
        }
    }
}

POST test/_doc
{
  "object.field": "value"
}

POST test/_search?q=object:*

Error:

java.lang.UnsupportedOperationException
org.elasticsearch.index.mapper.SearchAsYouTypeFieldMapper$PrefixFieldType.existsQuery(SearchAsYouTypeFieldMapper.java:397)
org.elasticsearch.index.query.ExistsQueryBuilder.newObjectFieldExistsQuery(ExistsQueryBuilder.java:214)
org.elasticsearch.index.query.ExistsQueryBuilder.newFieldExistsQuery(ExistsQueryBuilder.java:202)
org.elasticsearch.index.query.ExistsQueryBuilder.newFilter(ExistsQueryBuilder.java:164)
org.elasticsearch.index.search.QueryStringQueryParser.existsQuery(QueryStringQueryParser.java:635)

Relates to #64585, #63446.

@jtibshirani jtibshirani added >bug :Search/Search Search-related issues that do not fall into other categories labels Nov 4, 2020
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Nov 4, 2020
@jtibshirani jtibshirani changed the title Exists queries fail on search_as_you_type fields. Exists queries can fail on search_as_you_type fields. Nov 4, 2020
romseygeek added a commit that referenced this issue Nov 5, 2020
#64630)

PrefixFieldType can use the default existsQuery() implementation.

Fixes #64609
romseygeek added a commit that referenced this issue Nov 5, 2020
#64630)

PrefixFieldType can use the default existsQuery() implementation.

Fixes #64609
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants