# Is there a NOOP analyzer?

**URL:** <https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967>\
**Category:** Elasticsearch\
**Created:** [September 9, 2015, 9:08pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967 "2015-09-09T21:08:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dunnlow](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dunnlow](https://discuss.elastic.co/u/dunnlow)\
**Post date:** [September 9, 2015, 9:08pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/1 "2015-09-09T21:08:48Z")

</div>

I need to add a custom analyzer for a field during INDEX but I do not want any analysis done of the search term. I tried looking for an analyzer that would just group the entire search term as a complete phrase, like:

```
"dummy_analyzer":{
        "type":"pattern",
        "pattern":"00xyzzy00" <-- a dummy string trying to never separate words
}

```

I have my field mapped to use my custom analyzer during index and dummy analyzer during search, but I'm not convinced that's working (here is a [long description](https://discuss.elastic.co/t/analyzer-issues-using-query-string-in-es-1-5-2/28944) of why I think it's not working).

What is a good (/the right) way to put a custom analyzer on field for INDEX and have the field not analyzed during search?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 9, 2015, 9:15pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/2 "2015-09-09T21:15:16Z")

</div>

Are you looking for the keyword analyzer?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 9, 2015, 9:26pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/3 "2015-09-09T21:26:15Z")

</div>

Keyword

---

<div class="post-metadata">

**Author:** ![dunnlow](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dunnlow](https://discuss.elastic.co/u/dunnlow)\
**Post date:** [September 10, 2015, 2:26pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/4 "2015-09-10T14:26:59Z")

</div>

Thanks for your response. I tried keyword, but this still seems to parse individual words? Or, am I misinterpreting?

```
localhost:9200/myindex/_validate/query?explain=true&analyzer=keyword

```

with

```
{ "query" : {
   "query_string" : {
      {"query" : "Hello there",
       "fields" : ["name"],
       "analyzer":"keyword" <=put here and in validate call for grins
      } 
   }
}

```

my response is:

```
<explanations>
<e>
   <explanation>part.name:Hello part.name:there</explanation>
   <index>myindex</index>
   <valid>true</valid>
</e>
</explanations>

```

Doesn't this mean the keyword analyzer is still splitting my search into two tokens, "Hello" and "there"?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 10, 2015, 2:40pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/5 "2015-09-10T14:40:23Z")

</div>

Sadly, `query_string` always splits terms on spaces no matter what you put in the `analyzer` field. That is part of its query language. It just uses the analyzer to analyze the terms. I suspect `match` query will do what you want though. It doesn't support all of the flexibility that `query_string` supports but that is generally a good thing.

---

<div class="post-metadata">

**Author:** ![dunnlow](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dunnlow](https://discuss.elastic.co/u/dunnlow)\
**Post date:** [September 10, 2015, 3:08pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/6 "2015-09-10T15:08:02Z")

</div>

Wow, thank you for that! (I've been struggling with that one for that last two days.)

I'm a noob, but doesn't that seem like a bug (I will submit)? -- that the query\_string query ignores the tokenizer on my analyzer?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 10, 2015, 3:25pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/7 "2015-09-10T15:25:03Z")

</div>

> [@dunnlow](#):
>
> I'm a noob, but doesn't that seem like a bug (I will submit)? -- that the query\_string query ignores the tokenizer on my analyzer?

Its how its always worked and how it will forever work. If you are willing, have a read through the `query_string` [docs][[Query string query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)] and click the edit button and fix anything that is unclear. I'm not sure I can do it because I'm so used to `query_string`'s quirks that I assume too much when reading the docs.

---

<div class="post-metadata">

**Author:** ![dunnlow](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dunnlow](https://discuss.elastic.co/u/dunnlow)\
**Post date:** [September 10, 2015, 3:39pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/8 "2015-09-10T15:39:00Z")

</div>

Ok, will do. Regarding the docs, a few things additionally confused me:

- "phrase\_slop" - I read the docs to say that if I have phrase\_slop = 0 that the search term will NOT be tokenized.
- "auto\_generate\_phrase\_queries" = true - To me says it does the same thing as phrase\_slop=0.

Is my understanding correct, and if so should the docs reflect they don't work?

(also, "fields" is missing from the list of top-level parameters - I can add that)

---

<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:51pm UTC](https://discuss.elastic.co/t/is-there-a-noop-analyzer/28967/9 "2017-07-05T23:51:13Z")

</div>


