疲劳是最舒适的枕头,努力工作吧。
mappings

mappings

es7.3 映射失败或未生效

ElasticsearchOmbres 回复了问题 • 2 人关注 • 1 个回复 • 2149 次浏览 • 2019-11-22 14:43 • 来自相关话题

Elasticsearch mapping 配置个人解读

Elasticsearch夏李俊 发表了文章 • 0 个评论 • 5297 次浏览 • 2018-02-09 15:47 • 来自相关话题

配置详解 文件中"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{}
----------------------------------------------------------------------------------------------------------------------------------------- 属性解说 版本5.X以前
  • index 可选值为analyzed(默认)和not_analyzed,如果是字段是字符串类型的,则可以是not_analyzed
  • store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
  • boost默认为1,定义了文档中该字段的重要性,越高越重要
  • null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
  • include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
  • type 可以指定String,long,int,doulbe,floot,boolean,等
版本5.X以后
  • 原本type string,其index 可选值为analyzed(默认)和not_analyzed,现在直接拆违type text( index analyzed),type keyword(index not_analyzed)
  • store 可选值为enable或false,指定该字段的原始值是否被写入索引中,默认为enable,即结果中不能返回该字段。
  • index 表示是否用于检索默认enable,可选false
------------------------------------------------------------------------------------------------------------------------------- 字段的数据类型
  • 简单类型string(指定分词器)
  • date(默认使用UTC保持,也可以使用format指定格式)
  • 数值类型(byte,short,integer,long,float,double)
  • boolean
  • binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
  • ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询)注意string是5.x以前的,5.x之后被分裂为text,keyword
有层级结构的类型,比如object 或者 nested. 特殊类型
  • geo_point
  • geo_shape
  • completion
 

es 将默认的日期匹配设置为seconds-since-the-epoch

回复

Elasticsearchshwtz 回复了问题 • 1 人关注 • 1 个回复 • 8558 次浏览 • 2018-01-05 11:19 • 来自相关话题

es7.3 映射失败或未生效

回复

ElasticsearchOmbres 回复了问题 • 2 人关注 • 1 个回复 • 2149 次浏览 • 2019-11-22 14:43 • 来自相关话题

es 将默认的日期匹配设置为seconds-since-the-epoch

回复

Elasticsearchshwtz 回复了问题 • 1 人关注 • 1 个回复 • 8558 次浏览 • 2018-01-05 11:19 • 来自相关话题

Elasticsearch mapping 配置个人解读

Elasticsearch夏李俊 发表了文章 • 0 个评论 • 5297 次浏览 • 2018-02-09 15:47 • 来自相关话题

配置详解 文件中"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{}
----------------------------------------------------------------------------------------------------------------------------------------- 属性解说 版本5.X以前
  • index 可选值为analyzed(默认)和not_analyzed,如果是字段是字符串类型的,则可以是not_analyzed
  • store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
  • boost默认为1,定义了文档中该字段的重要性,越高越重要
  • null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
  • include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
  • type 可以指定String,long,int,doulbe,floot,boolean,等
版本5.X以后
  • 原本type string,其index 可选值为analyzed(默认)和not_analyzed,现在直接拆违type text( index analyzed),type keyword(index not_analyzed)
  • store 可选值为enable或false,指定该字段的原始值是否被写入索引中,默认为enable,即结果中不能返回该字段。
  • index 表示是否用于检索默认enable,可选false
------------------------------------------------------------------------------------------------------------------------------- 字段的数据类型
  • 简单类型string(指定分词器)
  • date(默认使用UTC保持,也可以使用format指定格式)
  • 数值类型(byte,short,integer,long,float,double)
  • boolean
  • binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
  • ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询)注意string是5.x以前的,5.x之后被分裂为text,keyword
有层级结构的类型,比如object 或者 nested. 特殊类型
  • geo_point
  • geo_shape
  • completion