# \[SOLVED\] Keyword nested field

**URL:** <https://discuss.elastic.co/t/solved-keyword-nested-field/71535>\
**Category:** Elasticsearch\
**Created:** [January 13, 2017, 3:18pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535 "2017-01-13T15:18:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [January 13, 2017, 3:18pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/1 "2017-01-13T15:18:21Z")

</div>

Hi all,

I just upgraded from elasticsearch 2.3 to 5.0.1.

(Example with the field **toto** )

Before, with an analyzed field, I used to create a nested field to get a not analyzed field like **toto.raw**.

i just see now in 5.0.1, I dont need to do that because elasticsearch do the things for me with keyword nested field like **toto.keyword**.

Could you confirm am I right ? The nested field "keyword" is for the same purpose that the "raw" nested field ?

Thanks in advance,  
Alex

---

<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:** [January 13, 2017, 3:29pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/2 "2017-01-13T15:29:44Z")

</div>

yes. that is correct

---

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [January 13, 2017, 3:30pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/3 "2017-01-13T15:30:35Z")

</div>

Hi,

Thanks a lot for your quick answer !

Alex

---

<div class="post-metadata">

**Author:** ![askids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/askids/32/22252_2.png) [@askids](https://discuss.elastic.co/u/askids)\
**Post date:** [January 13, 2017, 6:07pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/4 "2017-01-13T18:07:14Z")

</div>

But will the field.keyword work only if the field is defined as keyword or will it work for all fields defined as text?

Thanks!

---

<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:** [January 13, 2017, 6:41pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/5 "2017-01-13T18:41:27Z")

</div>

type keyword is needed when you want to do things like sorting, aggregations...

---

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [January 13, 2017, 6:57pm UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/6 "2017-01-13T18:57:47Z")

</div>

The field.keyword appears when you don't have the field defined on your mapping. If you need an analyzed field and the same field not analyzed, you need to create a nested field call field.raw, for example, with keyword type.

---

<div class="post-metadata">

**Author:** ![askids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/askids/32/22252_2.png) [@askids](https://discuss.elastic.co/u/askids)\
**Post date:** [January 17, 2017, 4:47am UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/7 "2017-01-17T04:47:16Z")

</div>

ok. That is what I currently have it as. Thanks.

---

<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:** [February 14, 2017, 4:47am UTC](https://discuss.elastic.co/t/solved-keyword-nested-field/71535/8 "2017-02-14T04:47:28Z")

</div>

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