# Find all documents with a missing field (“index”: false, “store”: true)

**URL:** https://discuss.elastic.co/t/find-all-documents-with-a-missing-field-index-false-store-true/262626
**Category:** Elasticsearch
**Created:** [January 29, 2021, 10:13am UTC](https://discuss.elastic.co/t/find-all-documents-with-a-missing-field-index-false-store-true/262626 "2021-01-29T10:13:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tworogue](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tworogue/32/45591_2.png) [@tworogue](https://discuss.elastic.co/u/tworogue)
#### Post date: [January 29, 2021, 10:13am UTC](https://discuss.elastic.co/t/find-all-documents-with-a-missing-field-index-false-store-true/262626/1 "2021-01-29T10:13:13Z")

</div>

ElasticSearch version: 6.8.2

Index metadata fragment:

```auto
    {
      "my_index": {
        "mappings": {
            "type": {
                "properties": {
                    "my_field": {
                        "type": "text",
                        "index": false,
                        "store": true
                    },

```

I want to find all documents in the index, where:

- "my\_field" is absent OR
- "my\_field" is present, field value is null OR
- "my\_field" is present, field value is an empty array

I would use "exists" query ([Exists query | Elasticsearch Reference [7.10] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html)) for my purpose, but, as far as I understand, it only works with the indexed fields. In my case, it always returns all the documents.

How can I find all documents in this case, by the criteria defined above?

---

<div class="post-metadata">

### Author: ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)
#### Post date: [February 1, 2021, 11:04am UTC](https://discuss.elastic.co/t/find-all-documents-with-a-missing-field-index-false-store-true/262626/2 "2021-02-01T11:04:33Z")

</div>

You can use the [Script Query | Elasticsearch Reference [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-script-query.html). This query won't run very quickly though.

---

<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: [March 1, 2021, 11:04am UTC](https://discuss.elastic.co/t/find-all-documents-with-a-missing-field-index-false-store-true/262626/3 "2021-03-01T11:04:48Z")

</div>

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