# \[SOLVED\] Query on field.exact returning zero results. Mapping issue?

**URL:** <https://discuss.elastic.co/t/solved-query-on-field-exact-returning-zero-results-mapping-issue/46852>\
**Category:** Elasticsearch\
**Created:** [April 9, 2016, 12:26am UTC](https://discuss.elastic.co/t/solved-query-on-field-exact-returning-zero-results-mapping-issue/46852 "2016-04-09T00:26:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zelfapp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zelfapp/32/108888_2.png) [@Zelfapp](https://discuss.elastic.co/u/Zelfapp)\
**Post date:** [April 9, 2016, 12:26am UTC](https://discuss.elastic.co/t/solved-query-on-field-exact-returning-zero-results-mapping-issue/46852/1 "2016-04-09T00:26:57Z")

</div>

SOLVED [https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-put-mapping.html#updating-field-mappings](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-put-mapping.html#updating-field-mappings)

I use PUT mapping to add sku.exact to the user field, but didn't read docs carefully enough for this function. It appears my mapping is just fine, I just had to reindex against new mapping.

**Problem before realizing I didn't read the docs:**

I'm trying to search on user.exact for "[testing.mydomain.com](http://testing.mydomain.com)", but am getting zero results. This should be so simple, but I've fouled the mapping up apparently and I can't seem to fix it. Any pointers would be much appreciated.

**Query:**

```
GET _search
{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "user.exact": "testing.mydomain.com"
        }
      }
    }
  }
}

```

**Example Source:**

```
{
    "user": "testing.mydomain.com"
}

```

**Mapping:**

```
{
    "index": "testing",
    "body": {
        "settings": {
            "number_of_shards": 1,
            "number_of_replicas": 1,
            "analysis": {
                "filter": {
                    "name_ngrams": {
                        "side": "front",
                        "max_gram": "10",
                        "min_gram": 1,
                        "type": "edgeNGram"
                    }
                },
                "analyzer": {
                    "full_name": {
                        "filter": [
                            "standard",
                            "lowercase"
                        ],
                        "type": "custom",
                        "tokenizer": "standard"
                    },
                    "partial_name": {
                        "filter": [
                            "standard",
                            "lowercase",
                            "name_ngrams"
                        ],
                        "type": "custom",
                        "tokenizer": "standard"
                    },
                    "sortable": {
                        "filter": [
                            "lowercase"
                        ],
                        "type": "custom",
                        "tokenizer": "keyword"
                    }
                }
            }
        },
        "mappings": {
            "test": {
                "_all": {
                    "enabled": false
                },
                "properties": {
                    "user": {
                        "fields": {
                            "exact": {
                                "type": "string",
                                "index": "not_analyzed"
                            },
                            "partial": {
                                "search_analyzer": "full_name",
                                "analyzer": "partial_name",
                                "type": "string"
                            },
                            "user": {
                                "type": "string",
                                "analyzer": "full_name"
                            },
                            "sortable": {
                                "type": "string",
                                "analyzer": "sortable"
                            }
                        },
                        "type": "multi_field"
                    }
                }
            }
        }
    }
}
```

---

<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:** [July 5, 2017, 11:01pm UTC](https://discuss.elastic.co/t/solved-query-on-field-exact-returning-zero-results-mapping-issue/46852/2 "2017-07-05T23:01:02Z")

</div>

Closed on July 5, 2017, 11:01pm UTC


