# Pharse suggester with field search in query syntax

**URL:** <https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926>\
**Category:** Elasticsearch\
**Created:** [May 2, 2016, 7:09am UTC](https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926 "2016-05-02T07:09:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![litalk](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@litalk](https://discuss.elastic.co/u/litalk)\
**Post date:** [May 2, 2016, 7:09am UTC](https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926/1 "2016-05-02T07:09:01Z")

</div>

I am trying to implement "did you mean" feature using the elasticsearch phrase suggester.  
It works OK, except when using field search in query syntax.

The query syntax I use is Query String Query

Here is an example of a query:

```
{
  "from" : 0,
  "size" : 10,
  "query" : {
    "query_string" : {
      "query" : "defect.fields.description:(tetsing)",
      "use_dis_max" : true
    }
  },
  "suggest" : {
    "phrase-suggest-iris" : {
      "text" : "defect.fields.description:(tetsing)",
      "phrase" : {
        "analyzer" : "default",
        "field" : "_all",
        "max_errors" : 2.0,
        "highlight" : {
          "pre_tag" : "<b>",
          "post_tag" : "</b>"
        }
      }
    }
  }
}

```

And here is what I get in the suggestions:

> defect.fields.description testing

The ":" is missing from the suggestions and other operators like "()".  
It seems like the suggeter does not keep query syntax.

Any help/suggestion would be appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 2, 2016, 7:29am UTC](https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926/2 "2016-05-02T07:29:00Z")

</div>

Because of the default analyser, which splits things up and would remove those non-alphas.  
You may want to look at setting that non-analyzed instead.

---

<div class="post-metadata">

**Author:** ![litalk](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@litalk](https://discuss.elastic.co/u/litalk)\
**Post date:** [May 2, 2016, 11:50am UTC](https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926/3 "2016-05-02T11:50:17Z")

</div>

What do you mean by not\_analyzed? I think it is not a valid value for "analyzer", plus I do want the suggester to analyze the text because I all my fields are analyzed and I need it to break the words, I just want it to keep lucene query string language.  
I can also have complex searches that combine free text search with field search, e.g.:

`"query_string" : { "query" : "login failed defect.fields.description:(tetsing)", "use_dis_max" : true }`

---

<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, 10:54pm UTC](https://discuss.elastic.co/t/pharse-suggester-with-field-search-in-query-syntax/48926/4 "2017-07-05T22:54:45Z")

</div>


