# Search/Filter on exact keyword with email value

**URL:** <https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425>\
**Category:** Elasticsearch\
**Created:** [June 30, 2021, 8:06am UTC](https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425 "2021-06-30T08:06:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [June 30, 2021, 8:06am UTC](https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425/1 "2021-06-30T08:06:44Z")

</div>

We cannot find documents with an email keyword exact match. Other keywords work so I guess it's the `@` symbol.

- How do we /\_search documents with exact keyword match
- I thought keywords worked with exact match only (no tokenizer/analyzer complexity)
- How can we /\_analyze the query to understand it better

## Mapping:

```auto
"properties": {
...
   "email": {
      "type": "keyword"
   }
...
}

```

## Document:

```auto
_source: {
   "email": "foo@bar.com"
}

```

## Search

```auto
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "analyze_wildcard": true,
            "query": "email: foo@bar.com"
          }
        }
      ]
    }
  }

```

OR

```auto
{
    "from": 0,
    "size": 100,
    "query": {
        "term": {
            "email": "foo@bar.com"
        }
    }
}

```

## No Results:

```auto
{
    "took": 502,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    }
}

```

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [June 30, 2021, 8:29am UTC](https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425/2 "2021-06-30T08:29:04Z")

</div>

Sorry, the issue was an incorrect mapping! What I posted was incorrect.

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [June 30, 2021, 8:30am UTC](https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425/3 "2021-06-30T08:30:54Z")

</div>

I have now updated the mapping on the index but it does not return the documents.

How can I "refresh" the index somehow?

My index (logs-000061) is part of ILM so I am unsure if I can reindex it to a temporary index, delete the original index, and reindex back?

---

<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 28, 2021, 8:31am UTC](https://discuss.elastic.co/t/search-filter-on-exact-keyword-with-email-value/277425/4 "2021-07-28T08:31:40Z")

</div>

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