当前位置: 首页 > news >正文

做真实3d效果图网站福州seo顾问

做真实3d效果图网站,福州seo顾问,专业网站建设模板下载,合肥万户网站建设原文网址:ES之API系列--index template(索引模板)的用法(有实例)_IT利刃出鞘的博客-CSDN博客 简介 说明 本文介绍ElasticSearch的index template(索引模板)的用法(有实例)。 官网网址 https://www.elastic.co/guide/en/elasticsearch/reference/8.0/index-temp…

原文网址:ES之API系列--index template(索引模板)的用法(有实例)_IT利刃出鞘的博客-CSDN博客

简介

说明

本文介绍ElasticSearch的index template(索引模板)的用法(有实例)。

官网网址

https://www.elastic.co/guide/en/elasticsearch/reference/8.0/index-templates.html

索引模板的作用

作用概述

        在新建索引时,如果索引名字与索引模板的通配符匹配,那么就使用索引模板的设置(_setting、_mapping等)。

  • 模板仅在索引创建时才会生效,而且修改模板不会影响现有的索引。
  • 可以指定"priority"的数值,如果新建的索引匹配到了多个模板,则使用priority最高的那个(priority值最小)。
    • 7.8之前的版本是"order"字段。会对匹配到的多个模板进行合并,如果一个字段在多个模板中,则取order比较小(优先级高)的那个。

应用场景

  1. 为将来的动态映射的索引进行限制
    1. 例如:有多个系统写入日志索引,每天生成一个新索引,采用动态映射的方式。原先系统的时间是yyyy-MM-dd HH:mm:ss,创建索引后动态映射的日期格式为:“"format":"strict_date_optional_time||epoch_millis||yyyy-MM-dd HH:mm:ss"”,新系统以yyyy-MM-dd HH:mm:ss.SSS格式写进去时会报错。
    2. 解决方案:直接将该日期字段改为:"format": "strict_date_optional_time||epoch_millis||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd HH:mm:ss.SSS"。创建索引时会支持新格式。
  2. 为创建索引提供便利
    1. 例如:可以在模板设置好number_of_shards,number_of_replicas,创建索引时就自动使用模板的配置,不需要再设置了。

版本的区别

7.8之后的命令是:_index_template

7.8之前的命令是:_template

用法完全一样。本文介绍7.8及之后的命令。

创建与更新索引模板

创建和更新的命令是一样的。如果不存在则创建,如果存在则更新。

简洁方法(_index_template)

PUT _index_template/template1
{"index_patterns": ["te*", "bar*"],"template": {"settings": {"number_of_shards": 1},"mappings": {"_source": {"enabled": false},"properties": {"host_name": {"type": "keyword"},"created_at": {"type": "date","format": "yyyy-MM-dd HH:mm:ss.SSS"}}},"aliases": {"mydata": { }}},"priority": 10,"version": 3,"_meta": {"description": "my custom"}
}

上边这个模板设置了index_patterns 为 te* 和bar*意思就是:te或bar开头的索引在创建时都会使用这个模板。

复杂方法(_index_template+_component_template)

PUT _component_template/component_template1
{"template": {"mappings": {"properties": {"@timestamp": {"type": "date"}}}}
}PUT _component_template/other_component_template
{"template": {"mappings": {"properties": {"ip_address": {"type": "ip"}}}}
}PUT _index_template/template_1
{"index_patterns": ["te*", "bar*"],"template": {"settings": {"number_of_shards": 1},"mappings": {"_source": {"enabled": false},"properties": {"host_name": {"type": "keyword"},"created_at": {"type": "date","format": "yyyy-MM-dd HH:mm:ss.SSS"}}},"aliases": {"mydata": { }}},"priority": 10,"composed_of": ["component_template1", "other_component_template"],"version": 3,"_meta": {"description": "my custom"}
}

index_template 创建时,如果它包含的 component_template与component_template 或 component_template与index_template 中properties存在重复的属性,则index_template创建会报错。

查看索引模板

查看所有索引模板

GET _index_template

示例 

查看单个索引模板

GET _index_template/template_name

示例

查看多个索引模板(通配符)

GET _index_template/template_pattern

示例

查看组件模板

GET _component_template/component_template_name

删除索引模板

删除索引模板

DELETE _index_template/template_name

删除组件模板

DELETE _component_template/component_template_name

日期检测与数字检测

概述

        如果某个字段没有设置映射,那么在新建文档时,会自动根据字段来生成映射,比如:日期和数字。

示例

  • 如果日期字段符合“yyyy-MM-dd HH:mm:ss.SSS"格式,就自动将该字段的type设置为date类型,并且format会包含“yyyy-MM-dd HH:mm:ss.SSS”这种格式。
  • 如果字段是个数字,则自动将该字段的type设置为Long之类的类型。

配置方法

默认这种类型检测是开启的,配置方法如下:

PUT _index_template/template_name
{"index_patterns": ["test*"],"priority": 1,"settings": {"number_of_shards": 1,"number_of_replicas": 2},"mappings": {"date_detection": false,"numeric_detection": true}
}

http://www.hkea.cn/news/977775/

相关文章:

  • 北京大兴最专业的网站建设公司如何推广一个项目
  • 网页设计最牛的网站建设宁波网站优化公司哪家好
  • 建设通查询如何做网站推广及优化
  • 城乡建设网站首页百度seo收录软件
  • 永久免费建个人网站培训网站建设
  • 如何使用jq做弹幕网站好用的磁力搜索引擎
  • 南充营销型网站建设高端品牌网站建设
  • 制作小程序和网站的公司搜狗收录提交入口网址
  • 手机站电影基础建站如何提升和优化
  • 江苏 网站备案百度贴吧官网app下载
  • 网站制作三站湖南网站seo公司
  • 简单做任务赚钱网站企业管理培训课程报名
  • 零点研究咨询集团官方网站建设相似图片在线查找
  • 网站开发需要什么软件关键词app
  • 360全景网站建设做了5天游戏推广被抓了
  • 政府网站建设经验典型材料河源今日头条新闻最新
  • 为什么要进行网站备案佛山市人民政府门户网站
  • 摄影网站开发背景百度app交易平台
  • 吉林网站建设石家庄百度快照优化排名
  • 大学生网站开发总结报告app推广接单发布平台
  • 自己做的网站怎么推广seo顾问培训
  • 怎么做业务网站百度搜索提交入口
  • 网页设计网站图片西安百度推广运营公司
  • 济南网站开发推广网络服务包括
  • 五星级酒店网站建设关键词歌词表达的意思
  • 浙江高端建设网站网站关键词如何优化
  • 2017网站开发工程师五合一网站建设
  • 学编程的孩子有什么好处seo网站诊断文档案例
  • 广州中新知识城开发建设网站无锡百姓网推广
  • 宝鸡做网站费用关键词你们懂的