Elasticsearch索引模板-转载
转载地址: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索引模板-转载的更多相关文章
- ElasticStack学习(八):ElasticSearch索引模板与聚合分析初探
		
一.Index Template与Dynamic Template的概念 1.Index Template:它是用来根据提前设定的Mappings和Settings,并按照一定的规则,自动匹配到新创建 ...
 - Elasticsearch索引模板和别名
		
创建模板(模板名和索引名一样都不能有大写) PUT http://222.108.x.x:9200/_template/templateds { "template": " ...
 - ES 10 - Elasticsearch的索引别名和索引模板
		
目录 1 索引模板概述 1.1 什么是索引模板 1.2 索引模板中的内容 1.3 索引模板的用途 2 创建索引模板 3 查看索引模板 4 删除索引模板 5 模板的使用建议 5.1 一个index中不能 ...
 - Elasticsearch之索引模板index template与索引别名index alias
		
为什么需要索引模板? 在实际工作中针对一批大量数据存储的时候需要使用多个索引库,如果手工指定每个索引库的配置信息(settings和mappings)的话就很麻烦了. 所以,这个时候,就存在创建索引模 ...
 - elasticsearch 5.x 系列之四(索引模板的使用,详细得不要不要的)
		
1,首先看一下下面这个索引模板 curl -XPUT "master:9200/_template/template_1?pretty" -H 'Content-Type: app ...
 - ElasticSearch(六):索引模板
		
ElasticSearch(六):索引模板 学习课程链接<Elasticsearch核心技术与实战> Index Template Index Template - 帮助你设定Mappin ...
 - Elasticsearch学习笔记——索引模板
		
在索引模板里面,date类型的字段的format支持多种类型,在es中全部会转换成long类型进行存储,参考 https://zhuanlan.zhihu.com/p/34240906 一个索引模板范 ...
 - Elasticsearch入门教程(三):Elasticsearch索引&映射
		
原文:Elasticsearch入门教程(三):Elasticsearch索引&映射 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文 ...
 - Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板
		
原文:Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接: ...
 
随机推荐
- how to check website offline status in js
			
how to check website offline status in js https://developer.mozilla.org/en-US/docs/Web/API/Navigator ...
 - js 拖拽排序
			
See alsoe: https://www.runoob.com/html/html5-draganddrop.html https://developer.mozilla.org/zh-CN/do ...
 - 知名金融媒体采访行业大咖,多方推动BGV茁壮成长
			
近来,多家知名金融媒体如纽约金融时报.伦敦金融时报等采访NGK官方代表洛索斯夫,以及美国当地行业大咖马库斯等人. 受访的NGK官方代币洛索斯夫回答道,近期官方将会推出NGK的书籍<NGK公链底层 ...
 - 【转】ROS之topic和service通信比较
			
实验速度 1. via topic 上图是以前ROS课上做的一个实验,内容是测试一个publisher和一个subscriber之间通讯所用的时间.两个node都很简单,publisher发送一个字符 ...
 - Golang 实现 Redis(9): 使用GeoHash 搜索附近的人
			
本文是使用 golang 实现 redis 系列的第九篇,主要介绍如何使用 GeoHash 实现搜索附近的人. 搜索附近的POI是一个非常常见的功能,它的技术难点在于地理位置是二维的(经纬度)而我们常 ...
 - python基础(2)字符串常用方法
			
python字符串常用方法 find(sub[, start[, end]]) 在索引start和end之间查找字符串sub 找到,则返回最左端的索引值,未找到,则返回-1 start和end都可 ...
 - Java多线程并发编程/锁的理解
			
一.前言 最近项目遇到多线程并发的情景(并发抢单&恢复库存并行),代码在正常情况下运行没有什么问题,在高并发压测下会出现:库存超发/总库存与sku库存对不上等各种问题. 在运用了 限流/加锁等 ...
 - .NET测试--模拟框架NSubstitute
			
.NET测试--模拟框架NSubstitute .NET测试 NSubstitute在GitHub的开源地址:https://github.com/nsubstitute/nsubstitute/do ...
 - pyinstaller打包exe运行失败
			
使用Pyinstaller来打包自己开发的软件时遇到的几个问题及解决方法.工具主要功能是数据分析,使用机器学习算法完成数据训练和预测功能.主要用到了两个学习库keras和sklearn,所以说在打包时 ...
 - POJ-3660(Floyd算法)
			
Cow Contest POJ-3660 1.本题考察的是最短路,用的算法是Floyd算法 2.如果一个结点和剩余的n-1个结点都有关系,那么可以确定其排名 3.需要注意的是,判断是否有关系时,反向关 ...