ElasticSearch6.0 索引模板
我们在做es搜索的场合,每次创建索引的时候,都需要为每个索引设置mapping的字段映射,现在我们可以为通用的索引创建一个模板
每次创建索引时候,如果匹配到相应的模板 索引的mapping会被自动设置成模板的mapping配置
PUT _template/temp_test
{
"index_patterns": ["market*", "car*"],//匹配规则
"settings": {
"index.number_of_shards" : 5, //分片数
"number_of_shards": 1 //数据副本
},
"mappings": {
"goods": {//索引类型
"dynamic_templates": [
{
"dynamicFields": {//动态字段
"match_mapping_type": "string",//动态字段匹配类型
"path_match":"dynamicFields.*_sku_attr",//匹配规则
"mapping":{
"type": "keyword" //匹配的字段的类型映射
}
}
}
],
"properties":{ //普通字段的类型设置
"id":{
"type": "keyword"
},
"category_first_id":{
"type": "keyword"
},
"category_first":{
"type": "keyword"
},
"category_second_id":{
"type": "keyword"
},
"category_second":{
"type": "keyword"
},
"category_third_id":{
"type": "keyword"
},
"category_third":{
"type": "keyword"
},
"brand_id":{
"type": "keyword"
},
"brand":{
"type": "text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_max_word",
"copy_to":"full_name"
},
"shop":{
"type": "keyword"
},
"attr_name":{
"type": "keyword",
"index":"true" },
"sku":{
"type": "keyword",
"index":"true"
},
"spu":{
"type": "keyword",
"index":"true"
},
"gome_sku":{
"type": "keyword"
},
"product_ch":{
"type": "text",
"analyzer":"ik_max_word",
"search_analyzer":"ik_max_word",
"copy_to":"full_name"
},
"adver":{
"type": "keyword"
},
"product_img":{
"type": "keyword"
},
"product_proto_price":{
"type": "double"
},
"product_sale_price":{
"type": "double"
},
"is_sku":{
"type": "boolean"
},
"is_self":{
"type": "boolean"
},
"shop_flag":{
"type": "long"
},
"is_in_store":{
"type": "boolean"
},
"is_shelves":{
"type": "boolean"
},
"is_suit":{
"type": "boolean"
},
"good_comment_rate":{
"type": "long"
},
"sale_num":{
"type": "long"
},
"spu_score":{
"type": "long"
},
"dynamic_attrs":{
"type": "keyword"
},
"full_name":{
"type": "text",
"store":"true"
},
"create_time":{
"type":"date"
}
}
}
}
}
ElasticSearch6.0 索引模板的更多相关文章
- ElasticSearch6.0 Java API 使用 排序,分组 ,创建索引,添加索引数据,打分等(一)
ElasticSearch6.0 Java API 使用 排序,分组 ,创建索引,添加索引数据,打分等 如果此文章对你有帮助,请关注一下哦 1.1 搭建maven 工程 创建web工程 ...
- ElasticSearch6.0 高级应用之 多字段聚合Aggregation(二)
ElasticSearch6.0 多字段聚合网上完整的资料很少 ,所以作者经过查阅资料,编写了聚合高级使用例子 例子是根据电商搜索实际场景模拟出来的 希望给大家带来帮助! 下面我们开始吧! 1. 创建 ...
- 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 ...
- ElasticStack学习(八):ElasticSearch索引模板与聚合分析初探
一.Index Template与Dynamic Template的概念 1.Index Template:它是用来根据提前设定的Mappings和Settings,并按照一定的规则,自动匹配到新创建 ...
- ElasticSearch(六):索引模板
ElasticSearch(六):索引模板 学习课程链接<Elasticsearch核心技术与实战> Index Template Index Template - 帮助你设定Mappin ...
- Elasticsearch学习笔记——索引模板
在索引模板里面,date类型的字段的format支持多种类型,在es中全部会转换成long类型进行存储,参考 https://zhuanlan.zhihu.com/p/34240906 一个索引模板范 ...
- Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板
原文:Elasticsearch7.X 入门学习第八课笔记-----索引模板和动态模板 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接: ...
随机推荐
- mysql批量修改列类型-生成语句
SELECT CONCAT( 'alter table ', table_name, ' MODIFY COLUMN ', column_name, ' float DEFAULT NULL;' ) ...
- Linux数据备份与恢复 dump、restore、dd命令
dump命令:备份分区.文件或目录 在Linux系统中 dump 命令是没有安装的,所以先安装一下 dump 命令,安装命令如下: [root@localhost -]# yum -y install ...
- 在DLL编程中,导出函数为什么需要extern "C"
转自:http://blog.csdn.net/zhongjling/article/details/8088664 一般来讲,在DLL编程过程中,对于导出的函数前 都需要加入 extern “C”, ...
- 让boost.variant支持lambda表达式访问
前言 之前写个过一篇博客叫<浅谈boost.variant的几种访问方式>,里面讲到了可以通过访问者方式来获取variant的值,但是在重载函数operator()里面只能够获取varia ...
- nuget发布自已的程序集
1.nuget注册并获取apikey 2.下载nuget.exe 3.设置apikey nuget setApiKey <apikey> 4.开发程序集 5.进入.csproj目录生成描述 ...
- java 与C# 时间格式 交互
方法一 C#端代码 IsoDateTimeConverter convert = new IsoDateTimeConverter(); string ret = JsonConvert.Serial ...
- 【c++ primer, 5e】定义类相关的非成员函数
练习 7.6 & 7.7 #include <iostream> #include <string> using namespace std; // Sales_dat ...
- js 图表处理之Echar
官网学习链接:http://echarts.baidu.com/tutorial.html#5%20分钟上手%20ECharts 案例代码: <!DOCTYPE html> <htm ...
- DNS ARP地址解析原理
ARP是地址解析协议 主机A与主机B之间如果要进行数据间的传输,需要获取对方的IP与物理地址(MAC),在只清楚ip的情况下,主机A向主机B请求链接,会先查找ARP高速缓存表,是否存在对应的主机B的i ...
- tomcat结合nginx或apache做负载均衡及session绑定
1.tomcat结合nginx做负载均衡,session绑定 nginx:192.168.223.136 tomcat:192.168.223.146:8081,192.168.223.146:8 ...