Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.52 KB

File metadata and controls

33 lines (23 loc) · 1.52 KB

Mapping for Elasticsearch 5.x+

In contrast to earlier versions, Elasticsearch has deprecated the string type in version 5. This affects the index setting on a field as well.

string is dead, long live strings

The string type was used for different things, namely analyzed content to be searched as fulltext, as well as in a non-analyzed way for keyword searches.

Thus string has been split into the new types text and keyword. Here is a "conversion table":

2.x 5.x
"type": "string", "index": "no" "type": "text", "index": false
"type": "string", "index": "analyzed" "type": "text", "index": true
"type": "string", "index": "not_analyzed" "type": "keyword", "index": true

If no index configuration is set, the default "type": "keyword", "index": true is used. So if you upgrade from previous elasticsearch version, check your node type configurations if they are configured as expected.

Conflicting field types

Something that has been enforced since version 2 of Elasticsearch is the fact that fields of the same name must have the same type within an index, across types. See https://www.elastic.co/blog/great-mapping-refactoring#conflicting-mappings.

With the split of string into two types, new conflicts of that type may arise.

To fix those conflicts, you may need to rename properties or adjust the mapping in your node types.