首页 技术 正文
技术 2022年11月6日
0 收藏 662 点赞 316 浏览 2594 个字

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

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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,122
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,594
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,439
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,210
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,846
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,931