Elasticsearch Is it possible to set a mapping for a field in an index for all types?

The Elasticsearch cluster can contain several indexes (databases), which, in turn, contain several types (tables). Is it possible to set a mapping for an index in an index for all types?

+5
source share
2 answers

Use the _default_ display option in the index. When the type is created, it will have the field mapping you are looking for.

PUT /my_index{ "mappings": { "_default_": { "properties": { "field1": { "type": "string", "index": "analyzed" } } } } 

You can also use the Index Template if you want all new indexes to have this default setting. I think it would be nice to improve dynamic templates at the index level so that they can be applied to different types. Now it is impossible.

+7
source

Source: https://habr.com/ru/post/1208272/


All Articles