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版权协议,转载请附上原文出处链接和本声明. 本文链接: ...
随机推荐
- hTML5 多图上传预览
<p> <label>请选择一个文件:</label> <input type="file" id="file" mu ...
- Could not connect to '192.168.89.144' (port 22)
xshell连接linux主机时,会出现错误:Could not connect to '192.168.89.144' (port 22): Connection failed. 但是这时能ping ...
- MLlib1.6指南笔记
MLlib1.6指南笔记 http://spark.apache.org/docs/latest/mllib-guide.html spark.mllib RDD之上的原始API spark.ml M ...
- JavaScript校验网址
JavaScript校验网址 var linkUrl = 'https://www.baidu.com' if( typeof (linkUrl) != undefined && li ...
- GATK的硬过滤
https://software.broadinstitute.org/gatk/documentation/article.php?id=2806
- 20145109 《Java程序设计》第九周学习总结
JDBC 1 . DriverManager Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); 2 . ...
- linux修改单个进程的系统时间
简介 如下是 libfaketime 的一个简单实例. 在工作中常常需要测试修改时间,如果环境不允许调整时间,就要想办法调整单个进程的时间了. 编译安装 git clone https://githu ...
- Swift学习笔记 - URL编码encode与解码decode
使用swift有一段时间了,api的变换造成了很多困扰,下面是关于url编码和解码问题的解决方案 在Swift中URL编码 在Swift中URL编码用到的是String的方法 func addingP ...
- mybatis映射文件_select_resultMap
实体类: Employee.java类: package com.hand.mybatis.bean; public class Employee { private Integer e ...
- nginx作为TCP反向代理
基于windows环境 基于nginx1.12.2版本 1. 解压nginx 2. 修改conf配置 # 打开conf/nginx,conf文件,写入以下配置 # upstream backend 里 ...