# Query analyzer confusion of multi-field containing keyword and analyzed

**URL:** <https://discuss.elastic.co/t/query-analyzer-confusion-of-multi-field-containing-keyword-and-analyzed/149498>\
**Category:** Elasticsearch\
**Created:** [September 21, 2018, 5:28pm UTC](https://discuss.elastic.co/t/query-analyzer-confusion-of-multi-field-containing-keyword-and-analyzed/149498 "2018-09-21T17:28:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)\
**Post date:** [September 21, 2018, 5:28pm UTC](https://discuss.elastic.co/t/query-analyzer-confusion-of-multi-field-containing-keyword-and-analyzed/149498/1 "2018-09-21T17:28:33Z")

</div>

Hello All -

I've come upon a behavior which I don't like. If the `fields` searched by `query_string` include a `keyword` (un`analyzed`) field in addition to an `analyzed` field, it seems the token-level analyzer won't omit symbols. Below is a Kibana Dev Tools Console example I tested with Elasticsearch 5.6.12 . We're in the midst of migrating to Elasticsearch 6 and I introduced this buggy behavior to our app when i disabled `_all` and turned on `"all_fields": true` by default (as part of our gradual migration). Is there a workaround for this that doesn't involve explicitly specifying only analyzed fields? I tried adding `"analyzer": "standard"` without success.

Thanks in advance,  
- Luke

```auto
PUT example
{}

PUT /example/widget/1
{
    "name": "alpha beta"
}

# hits
GET /example/_search
{
  "query": {
    "query_string": {
      "default_operator": "AND", 
      "query": "alpha & beta", 
      "fields": ["name"]
    }
  }
}

# no hits!?
GET /example/_search
{
  "query": {
    "query_string": {
      "default_operator": "AND", 
      "query": "alpha & beta", 
      "fields": ["name", "name.keyword"]
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Luke\_Nezda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luke_nezda/32/47152_2.png) [@Luke\_Nezda](https://discuss.elastic.co/u/Luke_Nezda)\
**Post date:** [September 24, 2018, 2:28pm UTC](https://discuss.elastic.co/t/query-analyzer-confusion-of-multi-field-containing-keyword-and-analyzed/149498/2 "2018-09-24T14:28:50Z")

</div>

Aha! I tested this locally with 6.4.1 and my test case works! I guess I'll have to tolerate this until we finish our migration to 6.x for these searches to return correct results.

---

<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:** [October 22, 2018, 2:28pm UTC](https://discuss.elastic.co/t/query-analyzer-confusion-of-multi-field-containing-keyword-and-analyzed/149498/3 "2018-10-22T14:28:53Z")

</div>

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