# Converting from 2.x to 5.x: "type": "string", "index": "no" -- use type or keyword?

**URL:** <https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616>\
**Category:** Elasticsearch\
**Created:** [February 2, 2017, 2:42am UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616 "2017-02-02T02:42:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lm\_es](https://avatars.discourse-cdn.com/v4/letter/l/e99b99/32.png) [@lm\_es](https://discuss.elastic.co/u/lm_es)\
**Post date:** [February 2, 2017, 2:42am UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616/1 "2017-02-02T02:42:38Z")

</div>

I know that in elasticsearch 5, the string field is no more. From this blog post: [https://www.elastic.co/blog/strings-are-dead-long-live-strings](https://www.elastic.co/blog/strings-are-dead-long-live-strings) I understand when to use text and when to use keyword when "index": "analyzed" or "index": "not\_analyzed".

But what should we use when "type": "string", "index": "no"? Does it matter?

Thanks.

---

<div class="post-metadata">

**Author:** ![mnozawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mnozawa/32/15091_2.png) [@mnozawa](https://discuss.elastic.co/u/mnozawa)\
**Post date:** [February 2, 2017, 5:07am UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616/2 "2017-02-02T05:07:48Z")

</div>

Hi,

If you want to aggregate or sort by the field, I think the **"keyword"** datatype is better because of **"doc\_values": true** by default.  
If not, maybe either is fine.

mnozawa

---

<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:** [February 2, 2017, 5:15am UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616/3 "2017-02-02T05:15:41Z")

</div>

I'd use text in that case with index: false

[https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html)

---

<div class="post-metadata">

**Author:** ![lm\_es](https://avatars.discourse-cdn.com/v4/letter/l/e99b99/32.png) [@lm\_es](https://discuss.elastic.co/u/lm_es)\
**Post date:** [February 7, 2017, 2:50pm UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616/4 "2017-02-07T14:50:22Z")

</div>

Thanks to both of you for your replies -- appreciate it! I decided to consistently use keyword in the end.

---

<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:** [March 7, 2017, 2:50pm UTC](https://discuss.elastic.co/t/converting-from-2-x-to-5-x-type-string-index-no-use-type-or-keyword/73616/5 "2017-03-07T14:50:41Z")

</div>

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