'exists' query not working for nested docs with norms=false

For fields within nested docs with norms disabled, querying for their existence via 'exists' query appears to not be working. It does however work when norms is enabled.

curl -XPUT localhost:9200/test -d '{
{
	"mappings": {
		"properties": {
			"user": {
				"type": "nested",
				"properties": {
					"first": {
						"type": "text",
						"norms": false
					},
					"last": {
						"type": "text"
					}
				}
			}
		}
	}
}'
curl -XPUT localhost:9200/test/_doc/1 -d '{
  "user" : [
    {
      "first" : "John",
      "last" :  "Smith"
    }
  ]
}'
curl -XGET localhost:9200/test/_search -d '{
  "query": {
    "nested": {
      "path": "user",
      "query": {
        "bool": {
          "must": [
            { "exists": { "field": "user.first" }}
          ]
        }
      }
    }
  }
}'

This seems to work in version 7.10.2 which was the version we used prior to a recent upgrade.

Thanks for your help!

Fixed via Fix execution of exists query within nested queries on field with doc_values disabled by yrodiere · Pull Request #78841 · elastic/elasticsearch · GitHub

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.