ES学习笔记之---template的使用
发表于:2024-10-08 作者:千家信息网编辑
千家信息网最后更新 2024年10月08日,es提供template功能的出发点在哪里呢? 作为NoSQL数据库, ES在数据入库前是不做schema设定的, 也就是不限定数据字段.这对日志类型的数据来说, 是个利好的场景. 但是这种不设定sc
千家信息网最后更新 2024年10月08日ES学习笔记之---template的使用
es提供template功能的出发点在哪里呢? 作为NoSQL数据库, ES在数据入库前是不做schema设定的, 也就是不限定数据字段.这对日志类型的数据来说, 是个利好的场景. 但是这种不设定schema的做法, 有时有太过自由. 有些业务场景, 我们需要预先设定field的分词方式. 这时固然可以使用mappings解决. 但是业务接入前要通知一下,先建个索引, 想想有点不智能. 有没有更灵活一点的做法呢? templates
templates的使用很简单, 但是想用好, 不出问题或者少出问题, 得有一整套流程:
创建template
curl -XPUT localhost:9200/_template/template_1 -d '{"template" : "te*","settings" : { "number_of_shards" : 1, "number_of_replications":2},"mappings" : { "type1" : { "_source" : { "enabled" : false } }}}'
查看template
curl -XGET localhost:9200/_template/template_1?pretty
如果templates创建出错, 删除template
curl -XDELETE localhost:9200/_template/template_1
- template建好后, 要测试一下是否符合预期, 添加一条数据
$ curl -XPUT 'http://localhost:9200/template_test/tweet/1' -d '{"user" : "kimchy","post_date" : "2009-11-15T14:12:12","message" : "trying out Elasticsearch"}'
查看集群的状态, 如果分片副本设置错误, 有可能集群变成yellow
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
- 查看索引结构及数据样例
curl -XGET 'http://localhost:9200/twitter/_settings,_mappings?pretty'curl -XGET 'http://localhost:9200/template_test/tweet/1'
经过后面这些验证, 一般就能规避大多数问题了.
数据
问题
业务
做法
场景
索引
集群
利好
自由
也就是
出发点
副本
功能
字段
数据库
方式
日志
智能
流程
状态
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
武器突袭3服务器介绍
java 数据库 队列
公安部网络安全测评师
星际公民如何标记服务器
服务器和轻量服务器有啥区别
橙道网络技术
阿里云服务器怎么做安全配置
修订网络安全管理以及
服务器网络安全拓扑图
关系型数据库有那些
网络安全主题怎么画手抄报
仪器触摸屏是用什么软件开发
四川省网络安全保卫大队
数据库变更什
网络安全工作哪些好
数据库引擎有几种
国辉软件开发公司
长沙数据库招商
数据库工作考证
sd卡 服务器
数据库集合运算结果
软件开发和中医正骨
无锡网络安全检查
大学生网络安全意识的内涵
召开网络安全工作会
淄博直播软件开发费用
河南软件开发网站有哪些
服务器x86和arm架构的区别
软件开发涉及的数学知识
银川广东网络安全培训