# Keyword datatype and analysis

**URL:** <https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359>\
**Category:** Elasticsearch\
**Created:** [November 17, 2016, 9:54am UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359 "2016-11-17T09:54:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [November 17, 2016, 9:54am UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/1 "2016-11-17T09:54:56Z")

</div>

Hello, everyone

I am currently testing elasticsearch 5.0. That version should, as far as I understand, solve and old problem of mine : allowing doc values to be used on keyword-analyzed fields.  
This is great, because I have absolutely no power over the json pushed via elasticsearch (actually, tempering with the source in any way, even changing the casing, would have legal repercussions)

Problem is, I make a lot of aggregations on fields that can be either given to me in lowercase, or in uppercase, so, "index" : "no" is not a viable solution.

Enter the "keyword" datatype. In my template, I built an analyser : key\_lowercase

> "analysis" : {  
> "analyzer" : {  
> "key\_lowercase" : {  
> "tokenizer" : "keyword",  
> "filter" : "lowercase"  
> }  
> },

And I try to use it such :

> "my\_field" : {  
> "type" : "keyword",  
> "analyzer" : "key\_lowercase"  
> },

In my understanding, this should work, the keyword data type having been created with that in mind.

However, when I try to push my template, I get this error :

> {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "Faled to parse mapping [my\_type]: Mapping definition for [my\_field] has unsuported parameters : [analyzer : key\_lowercase]  
> }

What did I not understand?  
How should I proceed to index those field in lowercase?  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 17, 2016, 10:55am UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/2 "2016-11-17T10:55:43Z")

</div>

This will be possible in 5.1. For now you have to workaround and use ingest lowercase processor.

---

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [November 17, 2016, 12:15pm UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/3 "2016-11-17T12:15:26Z")

</div>

Thanks for the reply,

Ah, ok, my bad .. I thought it was already possible. I'll wait for the 5.1, then.

About the ingest lowercase processor, that could do the trick, if it weren(t for 2 "problems" :  
Ingest seems to modify the source before indexing (If I get it right) , and we have, in all our mappings 250+ fields analysed with that key\_lowercase. (that seem to be a lot of work to turn around an issue that will be solved in the near future)

Anyway, I can wait a few months. Thank s again for the reply.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 17, 2016, 1:42pm UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/4 "2016-11-17T13:42:32Z")

</div>

I hope it will be released sooner than in months. 🙂

No precise date though.

---

<div class="post-metadata">

**Author:** ![knights](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@knights](https://discuss.elastic.co/u/knights)\
**Post date:** [December 9, 2016, 2:08pm UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/5 "2016-12-09T14:08:42Z")

</div>

Hello again !

I come back to you regarding the Elasticsearch 5.1.1 that got released.  
Nowhere in the docs/release notes does it show that using "keyword-type" analysis while using doc\_values on the keyword datatype is now possible.

Has it been postponed? Or outright cancelled?  
I'd be thankful for any infos.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2016, 2:27pm UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/6 "2016-12-09T14:27:13Z")

</div>

It is still opened

> <https://github.com/elastic/elasticsearch/issues/18064>

We thought it could be in 5.1 but it has been delayed.  
PR pending here:

> <https://github.com/elastic/elasticsearch/pull/21919>

---

<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:** [January 6, 2017, 2:27pm UTC](https://discuss.elastic.co/t/keyword-datatype-and-analysis/66359/7 "2017-01-06T14:27:36Z")

</div>

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