全文检索(elasticsearch) 索引mapping的配置指南
2018-02-09 14:18
288 查看
配置详解
文件中"mapping":{}中的内容,即为创建索引的mappingsource 如:"mappings": { "_default_" : { //@1 "_all" : {"enabled" : true}, //@2 "properties" : { //@3 "tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, //@4 "caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false} } }, "ec02_goodsinfo" : { //@5 "_all" : {"enabled" : true}, //@6 "properties" : { //@7 "tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, "perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false}, "bill":{ //@8 properties" : { "CreateYear" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : true} //@9 } } } } }
@1 _default_所有单据默认的创建索引的配置
@2 _all{} 每个单据下所有的字段配置,"enabled" : true 所有字段创建索引,false 所有字段禁止创建索引,[*注意]除非properties指定的字段,默认字段类型将自动匹配
@3 properties {},每个单据下字段或者properties的指定配置
@4 properties {}中指定了属性(properties):"tableType"的检索配置,type:string > 类型字符串,include_in_all:false > 改字段或者属性不包含在单据的所有字段中,"store": true > 储存在数据库中
@5 ec02_goodsinfo 表示对单据 "ec02_goodsinfo" 的特定检索配置
@6 _all{} 只对"ec02_goodsinfo"单据下所有的字段配置
@7 properties {},只对"ec02_goodsinfo"单据下字段或者properties的指定配置
[*注意]@8,@9 bill在单据中额字段都会包括一层bill,所以如果要对单据中某个字段指定需要套一层bill{}
属性解说
index 可选值为analyzed(默认)和no,如果是字段是字符串类型的,则可以是not_analyzed.store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
boost默认为1,定义了文档中该字段的重要性,越高越重要
null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
字段的数据类型
简单类型string(指定分词器)date(默认使用UTC保持,也可以使用format指定格式)
数值类型(byte,short,integer,long,float,double)
boolean
binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询).
有层级结构的类型,比如object 或者 nested.
特殊类型,比如geo_point, geo_shape, or completion.
相关文章推荐
- Elasticsearch全文检索企业开发记录总结(三):Mapping相关配置
- sphinx全文检索 安装配置和使用
- elasticsearch初级配置安装指南
- sphinx全文检索 安装配置和使用
- (转)全文检索技术学习(二)——配置Lucene的开发环境
- Elasticsearch全文检索企业开发记录总结(一):整体架构
- moss2007配置全文检索
- 【Elasticsearch】服务器开发 超越全文检索
- 10006---全文检索引擎Solr系列——Solr核心概念、配置文件
- oracle全文检索的配置
- elasticsearch中如何手动控制全文检索结果的精准度
- CoreSeek(全文检索引擎 Sphinx 中文版)安装使用指南(CentOS6.5)
- Elasticsearch实战——全文检索架构设计
- Scintilla使用指南(2) - 全文检索和修改
- 全文检索慨念/配置/常见问题总结
- 关于基于elasticsearch的全文检索 建立索引 查询
- Mapr搜索指南(一)——Mapr全文检索
- Elasticsearch全文检索实战小结
- 全文检索管理配置、使用手册
- windows下全文检索引擎sphinx/coreseek的安装配置