Elasticsearch 2.4至6.2父子关系破坏性变更及索引适配问询
Elasticsearch 父子文档索引实现与6.2版本适配调整
我把你之前的父子索引实现,以及针对Elasticsearch 6.2文档做的子索引修改,都用清晰的Markdown格式整理出来了:
原索引结构
子索引(index1)
这个索引定义了子文档类型XX,通过_parent字段关联父类型versiontest,同时开启了日期自动检测:
{ "XX": { "date_detection": true, "_parent": { "type": "versiontest" }, "properties": { "curatedBy": { "type": "keyword", "index": "true" } } } }
父索引(index2)
这是父文档类型YY的配置,关闭了日期自动检测,还定义了版本号和带指定格式的版本日期字段:
{ "YY": { "date_detection": false, "properties": { "versionnumber": { "type": "keyword" }, "versiondate": { "type": "date", "format": "yyyy/MM/dd HH:mm:ss" } } } }
适配Elasticsearch 6.2的子索引修改
根据ES 6.2的文档规范,你调整后的子索引配置(贴合6.x版本的join关联逻辑补充完整示例):
{ "XX": { "date_detection": true, "properties": { "curatedBy": { "type": "keyword", "index": true }, "join_field": { "type": "join", "relations": { "versiontest": "XX" } } } } }
小提示:Elasticsearch 6.x版本开始废弃了多类型索引,父子文档的关联不再用_parent字段,而是通过join类型字段来建立父子关系,这是你适配时需要重点注意的核心变化哦。
内容的提问来源于stack exchange,提问作者Abhi.G
相关产品推荐
相关产品推荐

