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


#1

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 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.


(Makoto Nozawa) #2

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


(David Pilato) #3

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

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


#4

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


(system) #5

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