博客
关于我
Elasticsearch索引模板-转载
阅读量:738 次
发布时间:2019-03-22

本文共 4632 字,大约阅读时间需要 15 分钟。

转载地址:

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

你可能感兴趣的文章
Mysql 整形列的字节与存储范围
查看>>
mysql 断电数据损坏,无法启动
查看>>
MySQL 日期时间类型的选择
查看>>
Mysql 时间操作(当天,昨天,7天,30天,半年,全年,季度)
查看>>
MySQL 是如何加锁的?
查看>>
MySQL 是怎样运行的 - InnoDB数据页结构
查看>>
mysql 更新子表_mysql 在update中实现子查询的方式
查看>>
MySQL 有什么优点?
查看>>
mysql 权限整理记录
查看>>
mysql 权限登录问题:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
查看>>
MYSQL 查看最大连接数和修改最大连接数
查看>>
MySQL 查看有哪些表
查看>>
mysql 查看锁_阿里/美团/字节面试官必问的Mysql锁机制,你真的明白吗
查看>>
MySql 查询以逗号分隔的字符串的方法(正则)
查看>>
MySQL 查询优化:提速查询效率的13大秘籍(避免使用SELECT 、分页查询的优化、合理使用连接、子查询的优化)(上)
查看>>
mysql 查询数据库所有表的字段信息
查看>>
【Java基础】什么是面向对象?
查看>>
mysql 查询,正数降序排序,负数升序排序
查看>>
MySQL 树形结构 根据指定节点 获取其下属的所有子节点(包含路径上的枝干节点和叶子节点)...
查看>>
mysql 死锁 Deadlock found when trying to get lock; try restarting transaction
查看>>