ElasticSearch|ElasticSearch - Template
Index Template
帮助你设定Mapping 和 Settings, 并按照一定的规则,自动匹配到新创建的索引之上。
- 模版仅在一个索引被新创建时,才会产生作用。修改模版不会影响已创建的索引
- 你可以设定多个索引模版,这些设置会被"merge"在一起
- 你可以指定"order"的数值,控制"merging"的过程
文章图片
image.png
左边的意思是设置所有的索引,主分片和副本都为1。
右边是已test开头的索引,主分片为1,副本为2。 属于日期类型的字段不会自动转化成日期类型,数字类型会自动转换。
Index Template的工作方式 当一个索引被新创建时:
- 应用Elasticsearch默认的settings和mappings
- 应用order数值低的Index Template中的设定
- 应用order高的Index Template中的设定,之前的设定会被覆盖
- 应用创建索引时,用户所指定的Settings和Mappings,并覆盖之前模版中的设定
- 所有的字符串类型都设定成Keyword,或者关闭Keyword字段
- is开头的字段都设置成boolean
- 【ElasticSearch|ElasticSearch - Template】long_开头的都设置成long类型
文章图片
image.png
推荐阅读
- ElasticSearch6.6.0强大的JAVA|ElasticSearch6.6.0强大的JAVA API详解
- Elasticsearch|Elasticsearch 简介
- com.android.dex.DexIndexOverflowException
- elasticsearch分析器
- 三十一、|三十一、 Elasticsearch集群搭建部署及配置
- springmvc|springmvc 集成 Spring Data Elasticsearch 遇到的坑
- python|python numpy中对ndarry按照index增删改查
- WPF使用代码创建数据模板DataTemplate
- Elasticsearch(一)什么是Elasticsearch
- elasticsearch|elasticsearch 7.0 新特性之 search as you type