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

**URL:** <https://discuss.elastic.co/t/exists-query-not-working-for-nested-docs-with-norms-false/288256>\
**Category:** Elasticsearch\
**Created:** [November 2, 2021, 7:01pm UTC](https://discuss.elastic.co/t/exists-query-not-working-for-nested-docs-with-norms-false/288256 "2021-11-02T19:01:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matobaa](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@matobaa](https://discuss.elastic.co/u/matobaa)\
**Post date:** [November 2, 2021, 7:01pm UTC](https://discuss.elastic.co/t/exists-query-not-working-for-nested-docs-with-norms-false/288256/1 "2021-11-02T19:01:26Z")

</div>

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.

```auto
curl -XPUT localhost:9200/test -d '{
{
	"mappings": {
		"properties": {
			"user": {
				"type": "nested",
				"properties": {
					"first": {
						"type": "text",
						"norms": false
					},
					"last": {
						"type": "text"
					}
				}
			}
		}
	}
}'

```

```auto
curl -XPUT localhost:9200/test/_doc/1 -d '{
  "user" : [
    {
      "first" : "John",
      "last" : "Smith"
    }
  ]
}'

```

```auto
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!

---

<div class="post-metadata">

**Author:** ![matobaa](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@matobaa](https://discuss.elastic.co/u/matobaa)\
**Post date:** [November 10, 2021, 7:24pm UTC](https://discuss.elastic.co/t/exists-query-not-working-for-nested-docs-with-norms-false/288256/2 "2021-11-10T19:24:15Z")

</div>

Fixed via [Fix execution of exists query within nested queries on field with doc\_values disabled by yrodiere · Pull Request #78841 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/pull/78841)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 8, 2021, 7:24pm UTC](https://discuss.elastic.co/t/exists-query-not-working-for-nested-docs-with-norms-false/288256/3 "2021-12-08T19:24:48Z")

</div>

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