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版权协议,转载请附上原文出处链接和本声明. 本文链接: ...
随机推荐
- vector 迭代 删除指定的元素
std::vector< Bullet * > m_vBullets; std::vector< Bullet * > m_vRemoveBulltes; ){ for ( s ...
- jsp 小记
1. select 默认选中: <select name="skills" multiple="true"> <option value=&q ...
- Linux学习笔记之CentOS6.9 防火墙的关闭以及开启
有的时候,我们需要对系统的防火墙进行操作,今天小编就给大家讲解一下如何开启以及关闭CentOS6.9系统下的防火墙. 输入:cat /etc/issue 查看版本 (一)通过service命令 s ...
- Nginx配置location跳转后偶尔出现404
tv.xxx.com/voice请求时需跳转至:tv.xxx.com/zongyi/zt2015/haoshengyin/index.shtml 目录结构: nginx服务器配置: location ...
- 20145303刘俊谦 Java 代码托管
(20145303刘俊谦) Java 第三周代码托管 这是最近保存下来的代码,今天一起上传的,有很多在代码学习过程中无意识删掉了:
- 20145327 《Java程序设计》第三周学习总结
20145327 <Java程序设计>第三周学习总结 教材学习内容总结 对象:存在的具体实体,具有明确的状态和行为. 类:具有相同属性和行为的一组对象的集合,用于组合各个对象所共有操作和属 ...
- # PHP学习笔记之一
PHP学习笔记之一 标签(空格分隔): PHP 资料来源:慕课网PHP入门篇.PHP学习手册 一.变量 变量定义 $变量名 = 变量值; $var = "xxx"; 变量类型查看 ...
- 爬虫之urllib2库的基本使用
urllib2库的基本使用 所谓网页抓取,就是把URL地址中指定的网络资源从网络流中读取出来,保存到本地. 在Python中有很多库可以用来抓取网页,我们先学习urllib2. urllib2 是 P ...
- LA 3971 组装电脑(二分)
https://vjudge.net/problem/UVALive-3971 题意:你有b块钱,想要组装一台电脑.给出n个配件各自的种类.品质因子和价格,要求每种类型的配件各买一个,总价格不超过b, ...
- arm-linux-gcc安装使用教程
arm-linux-gcc如何下载安装2(转) [转]ubuntu下交叉编译环境构建(arm-linux-gcc-3.4.1.tar.bz2 ) 2009-03-03 10:05 1.下载arm-li ...