# Help understanding keyword vs not\_analyzed

**URL:** <https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374>\
**Category:** Elasticsearch\
**Created:** [January 16, 2013, 3:15pm UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374 "2013-01-16T15:15:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ariel\_Valentin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ariel_valentin/32/2421_2.png) [@Ariel\_Valentin](https://discuss.elastic.co/u/Ariel_Valentin)\
**Post date:** [January 16, 2013, 3:15pm UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374/1 "2013-01-16T15:15:15Z")

</div>

My team is in the process of migrating an application from a custom Lucene  
based solution to elasticsearch and we have some questions about the  
keyword analyzer. In our "legacy" system we are indexing a field  
using org.apache.lucene.analysis.KeywordAnalyzer for searching and  
indexing.

According to the documentation: (

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

)

An analyzer of type keyword that “tokenizes” an entire stream as a single

> token. This is useful for data like zip codes, ids and so on. Note, when  
> using mapping definitions, it make more sense to simply mark the field as  
> not\_analyzed.

What advantage does using not\_analyzed have over analyzing it as a keyword?  
Is it functionally equivalent?

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 16, 2013, 3:17pm UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374/2 "2013-01-16T15:17:30Z")

</div>

> What advantage does using not\_analyzed have over analyzing it as a  
> keyword? Is it functionally equivalent?

Yes, they are equivalent

clint

> --

--

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [January 16, 2013, 3:18pm UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374/3 "2013-01-16T15:18:30Z")

</div>

Hello!

They are not totally equivalent. With keyword analyzer you can add additional filters, like lowercase one for example and have your text as a single term in the index although analyzed a bit. When setting the field to not\_analyzed you'll have the field as it is.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

My team is in the process of migrating an application from a custom Lucene based solution to elasticsearch and we have some questions about the keyword analyzer. In our "legacy" system we are indexing a field using org.apache.lucene.analysis.KeywordAnalyzer for searching and indexing.

According to the documentation: ([http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html))

An analyzer of type keyword that “tokenizes” an entire stream as a single token. This is useful for data like zip codes, ids and so on. Note, when using mapping definitions, it make more sense to simply mark the field as not\_analyzed.

What advantage does using not\_analyzed have over analyzing it as a keyword? Is it functionally equivalent?

--

---

<div class="post-metadata">

**Author:** ![Rafal\_Kuc\_3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafal_kuc_3/32/799_2.png) [@Rafal\_Kuc\_3](https://discuss.elastic.co/u/Rafal_Kuc_3)\
**Post date:** [January 16, 2013, 3:20pm UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374/4 "2013-01-16T15:20:31Z")

</div>

Hello!

Sorry, you are talking about keyword _analyzer_, not the _tokenizer_ ([http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-tokenizer.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-tokenizer.html)). In that Clinton is right.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

Hello!

They are not totally equivalent. With keyword analyzer you can add additional filters, like lowercase one for example and have your text as a single term in the index although analyzed a bit. When setting the field to not\_analyzed you'll have the field as it is.

_--_

Regards,

Rafał Kuć

Sematext :: [http://sematext.com/](http://sematext.com/) _:: Solr - Lucene - Nutch - ElasticSearch_

My team is in the process of migrating an application from a custom Lucene based solution to elasticsearch and we have some questions about the keyword analyzer. In our "legacy" system we are indexing a field using org.apache.lucene.analysis.KeywordAnalyzer for searching and indexing.

According to the documentation: ([http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html))

An analyzer of type keyword that “tokenizes” an entire stream as a single token. This is useful for data like zip codes, ids and so on. Note, when using mapping definitions, it make more sense to simply mark the field as not\_analyzed.

What advantage does using not\_analyzed have over analyzing it as a keyword? Is it functionally equivalent?

--

--

---

<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 6, 2017, 2:56am UTC](https://discuss.elastic.co/t/help-understanding-keyword-vs-not-analyzed/10374/5 "2017-07-06T02:56:07Z")

</div>


