转载地址:https://dongbo0737.github.io/2017/06/13/elasticsearch-template/#similar_posts

Elasticsearch索引模板

使用Elasticsearch 存储数据的时候,每个单独的索引,或者一个类型的索引都可能有些自己特殊的属性,这样我们就要使用template了 通过指定指定的模版名字,来定义这个类型的索引多少个分片和副本,哪些字段不需要分词等等 使用*可以模糊匹配索引.

例如: business-* 可以匹配到 business-2017.05.01

business template

{
"order": 0,
"template": "test-business-*",
"settings": {
"index": {
"routing": {
"allocation": {
"require": {
"box_type": "hot"
}
}
},
"refresh_interval": "3s",
"analysis": {
"filter": {
"camel_filter": {
"split_on_numerics": "false",
"type": "word_delimiter",
"stem_english_possessive": "false",
"generate_number_parts": "false",
"protected_words": [
"iPhone",
"WiFi"
]
}
},
"analyzer": {
"camel_analyzer": {
"filter": [
"camel_filter",
"lowercase"
],
"char_filter": [
"html_strip"
],
"type": "custom",
"tokenizer": "ik_smart"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "whitespace",
"enable_lowercase": "false"
}
}
},
"number_of_shards": "30",
"number_of_replicas": "0"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"message_field": {
"mapping": {
"analyzer": "camel_analyzer",
"index": "analyzed",
"omit_norms": true,
"type": "string"
},
"match_mapping_type": "string",
"match": "message"
}
},
{
"logid_field": {
"mapping": {
"type": "long"
},
"match_mapping_type": "string",
"match": "logid"
}
},
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"omit_norms": true,
"type": "string",
"fields": {
"raw": {
"ignore_above": 256,
"index": "not_analyzed",
"type": "string"
}
}
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"_all": {
"omit_norms": true,
"enabled": true
},
"properties": {
"geoip": {
"dynamic": true,
"type": "object",
"properties": {
"location": {
"type": "geo_point"
}
}
},
"@version": {
"index": "not_analyzed",
"type": "string"
}
}
}
},
"aliases": {}
}

webaccess template

{
"order": 0,
"template": "test-webaccess-*",
"settings": {
"index": {
"routing": {
"allocation": {
"require": {
"box_type": "hot"
}
}
},
"refresh_interval": "3s",
"analysis": {
"analyzer": {
"ik": {
"type": "custom",
"tokenizer": "ik_smart"
}
}
},
"number_of_shards": "20",
"number_of_replicas": "0"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"message_field": {
"mapping": {
"analyzer": "ik",
"index": "analyzed",
"omit_norms": true,
"type": "string"
},
"match_mapping_type": "string",
"match": "message"
}
},
{
"bytes_field": {
"mapping": {
"type": "long"
},
"match_mapping_type": "string",
"match": "bytes"
}
},
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"omit_norms": true,
"type": "string",
"fields": {
"raw": {
"ignore_above": 256,
"index": "not_analyzed",
"type": "string"
}
}
},
"match_mapping_type": "string",
"match": "*"
}
}
],
"_all": {
"omit_norms": true,
"enabled": true
},
"properties": {
"geoip": {
"dynamic": true,
"type": "object",
"properties": {
"location": {
"type": "geo_point"
}
}
},
"@version": {
"index": "not_analyzed",
"type": "string"
}
}
}
},
"aliases": {}
}

Similar Posts

Elasticsearch索引模板-转载的更多相关文章

  1. ElasticStack学习(八):ElasticSearch索引模板与聚合分析初探

    一.Index Template与Dynamic Template的概念 1.Index Template:它是用来根据提前设定的Mappings和Settings,并按照一定的规则,自动匹配到新创建 ...

  2. Elasticsearch索引模板和别名

    创建模板(模板名和索引名一样都不能有大写) PUT http://222.108.x.x:9200/_template/templateds { "template": " ...

  3. ES 10 - Elasticsearch的索引别名和索引模板

    目录 1 索引模板概述 1.1 什么是索引模板 1.2 索引模板中的内容 1.3 索引模板的用途 2 创建索引模板 3 查看索引模板 4 删除索引模板 5 模板的使用建议 5.1 一个index中不能 ...

  4. Elasticsearch之索引模板index template与索引别名index alias

    为什么需要索引模板? 在实际工作中针对一批大量数据存储的时候需要使用多个索引库,如果手工指定每个索引库的配置信息(settings和mappings)的话就很麻烦了. 所以,这个时候,就存在创建索引模 ...

  5. elasticsearch 5.x 系列之四(索引模板的使用,详细得不要不要的)

    1,首先看一下下面这个索引模板 curl -XPUT "master:9200/_template/template_1?pretty" -H 'Content-Type: app ...

  6. ElasticSearch(六):索引模板

    ElasticSearch(六):索引模板 学习课程链接<Elasticsearch核心技术与实战> Index Template Index Template - 帮助你设定Mappin ...

  7. Elasticsearch学习笔记——索引模板

    在索引模板里面,date类型的字段的format支持多种类型,在es中全部会转换成long类型进行存储,参考 https://zhuanlan.zhihu.com/p/34240906 一个索引模板范 ...

  8. Elasticsearch入门教程(三):Elasticsearch索引&映射

    原文:Elasticsearch入门教程(三):Elasticsearch索引&映射 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文 ...

  9. Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板

    原文:Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接: ...

随机推荐

  1. Learning JavaScript with MDN (call, apply, bind)

    Learning JavaScript with MDN (call, apply, bind) call, apply, bind Object.prototype.toString() 检测 js ...

  2. onsen & UI & vue & mobile UI

    onsen & UI vue & mobile UI $ npm i onsenui vue-onsenui # OR $ npm i -S onsenui vue-onsenui h ...

  3. HTTP/3 protocol

    HTTP/3 protocol https://caniuse.com/#feat=http3 HTTP/3 H3 https://en.wikipedia.org/wiki/HTTP/3 QUIC ...

  4. 03.Jupyter Notebook高级-魔法命令

    %run %run C:\Users\User\Desktop\hello.py hello world %timeit %timeit L = [i for i in range(1000)] 29 ...

  5. 面试20家互联网公司总结出的高频MySQL面试题

    1.MyISAM存储获与InnoDB存储引擎  MyISAM存储引擎不支持事务.表锁设计.支持全文索引.缓冲池只缓存索引文件,并不缓存数据文件. InnoDB存储引擎支持事务.行锁设计.支持外键,支持 ...

  6. http server源码解析

    本文主要过下http生成服务和处理请求的主要流程,其他功能并未涉及. 使用例子 const http = require('http'); http.createServer((req, res) = ...

  7. rar密码破解工具汇总

    rar密码破解工具汇总 前言 假如酷爱在网络上找各种资源的你,经历千辛万苦终于找到了一个rar打包的文件,兴奋地慌忙点击,可打开才发现是加密的,相信这样的场景很多人都遇到过,今天就针对压缩文件密码的破 ...

  8. Vue项目的创建、路由、及生命周期钩子

    目录 一.Vue项目搭建 1.环境搭建 2.项目的创建 3.pycharm配置并启动vue项目 4.vue项目目录结构分析 5.Vue根据配置重新构建依赖 二.Vue项目创建时发生了什么 三.项目初始 ...

  9. Docker的架构

    一.Docker引擎 docker引擎是一个c/s结构的应用,主要组件见下图: Server是一个常驻进程 REST API 实现了client和server间的交互协议 CLI 实现容器和镜像的管理 ...

  10. docker mysql初始化多个sql脚本

    一.概述 现有一台服务器,需要部署mysql.其中mysql容器,需要在第一次启动时,执行多个sql文件. 文件名 说明 执行顺序 init.sql 创建数据库以及用户 1 users.sql 用户表 ...