# Querying on a field that does not exist will return results

**URL:** <https://discuss.elastic.co/t/querying-on-a-field-that-does-not-exist-will-return-results/203240>\
**Category:** Elasticsearch\
**Created:** [October 11, 2019, 1:15pm UTC](https://discuss.elastic.co/t/querying-on-a-field-that-does-not-exist-will-return-results/203240 "2019-10-11T13:15:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaron.horst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron.horst/32/8485_2.png) [@aaron.horst](https://discuss.elastic.co/u/aaron.horst)\
**Post date:** [October 11, 2019, 1:15pm UTC](https://discuss.elastic.co/t/querying-on-a-field-that-does-not-exist-will-return-results/203240/1 "2019-10-11T13:15:45Z")

</div>

When querying on a property that does not exist in ES 6.4 I notice that documents are returned despite the fact it is not in the mappings. See the below example. The name property exists however aklsdfkljasdf does not exist in the mappings. The query below will return any document matching with a name of user-login and it acts like the aklsdfkljasdf portion of the query is not evaluated.

I would expect this to return no results as the property does not exist. Looking for some assistance to understand why this is the case.

```
POST /myindexname/_search 
{
  "version": true,
  "size": 500,
  "_source": {
    "excludes": []
  },
  "stored_fields": [
    "*"
  ],
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "+name:(\"user-login\") +aklsdfkljasdf:(\"asdf\")",
            "analyze_wildcard": true,
            "default_field": "*"
          }
        }
      ]
    }
  }
}

```

Results

 ![QueryingNonExistantFieldWithoutResults](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a289a1dd541bf9b8855b02f4cb37387864e7462.jpeg)

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 11, 2019, 4:43pm UTC](https://discuss.elastic.co/t/querying-on-a-field-that-does-not-exist-will-return-results/203240/2 "2019-10-11T16:43:14Z")

</div>

I tried this quickly and couldn’t reproduce (admittedly on 6.6).  
Can you share a minimal reproduction (mapping, doc and query)?

---

<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:** [November 8, 2019, 4:43pm UTC](https://discuss.elastic.co/t/querying-on-a-field-that-does-not-exist-will-return-results/203240/3 "2019-11-08T16:43:16Z")

</div>

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