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 returns no documents for a no-value constant_keyword #53545

Closed
astefan opened this issue Mar 13, 2020 · 1 comment · Fixed by #55757
Closed

exists query returns no documents for a no-value constant_keyword #53545

astefan opened this issue Mar 13, 2020 · 1 comment · Fixed by #55757
Labels
>bug :Search/Search Search-related issues that do not fall into other categories

Comments

@astefan
Copy link
Contributor

astefan commented Mar 13, 2020

Considering the following mapping

{
  "mappings": {
    "properties": {
      "cycle_type": {
        "type": "constant_keyword"
      },
      "name": {
        "type": "text"
      }
    }
  }
}

And the following bulk of documents:

{"index":{"_id":1}}
{"name":"kawasaki"}
{"index":{"_id":2}}
{"name":"1938"}
{"index":{"_id":3}}
{"name":"1924"}

there won't be any value associated with cycle_type field. But, running the following query has some unexpected results:

{
    "query": {
        "bool": {
            "must_not": [
                {
                    "exists": {
                        "field": "cycle_type"
                    }
                }
            ]
        }
    }
}

There won't be any documents returned, whereas it should return all of them because cycle_type doesn't have a value.

@astefan astefan added the :Search/Search Search-related issues that do not fall into other categories label Mar 13, 2020
@elasticmachine
Copy link
Collaborator

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

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants