ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] * 索引模板,主要用于在新建索引时自动应用预先设定的配置,简化索引创建的操作步骤 * 可以设定索引的setting和mapping * 可以有多个模板,根据order设置,order大的覆盖小的配置 * 索引模板API,endpoint为 \_template ~~~ # 创建索引模板,匹配 test-index-map 开头的索引 PUT _template/template_1 { "index_patterns": ["test-index-map*"], "order": 2, "settings": { "number_of_shards": 1 }, "mappings": { "doc": { "_source": { "enabled": false }, "properties": { "name": { "type": "keyword" }, "created_at": { "type": "date", "format": "YYYY/MM/dd HH:mm:ss" } } } } } # 插入一个文档 POST test-index-map_1/doc { "name" : "小旋锋", "created_at": "2018/08/16 20:11:11" } # 获取该索引的信息,可以发现 settings 和 mappings 和索引模板里设置的一样 GET test-index-map_1 # 删除 DELETE /_template/template_1 # 查询 GET /_template/template_1 ~~~