gpt4 book ai didi

elasticsearch - 升级到Elasticsearch 5.2

转载 作者:行者123 更新时间:2023-12-03 01:47:09 25 4
gpt4 key购买 nike

我有以下在ES 1.7中可用但在5.2中失败的旧版映射代码。失败的原因是multi_field和path。该文档提到这些字段已被删除,但是除了建议使用copy_to以外,无法提供其他补救措施。有人可以提供更多详细信息吗?

{
"sample": {
"_parent": {
"type": "security"
},
"properties": {
"securityDocumentId": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"id": {
"type": "multi_field",
"path": "full",
"fields": {
"indexer_sample_id": {
"type": "string"
},
"id": {
"type": "string",
"include_in_all": false
}
}
},
"sampleid": {
"type": "multi_field",
"path": "just_name",
"fields": {
"sampleid": {
"type": "string",
"analyzer": "my_analyzer"
},
"sample.sampleid": {
"type": "string",
"analyzer": "my_analyzer"
},
"sample.sampleid.sort": {
"type": "string",
"analyzer": "case_insensitive_sort_analyzer"
},
"sample.sampleid.name.autocomplete": {
"type": "string",
"analyzer": "autocomplete"
}
}
},

最佳答案

path选项的默认值为full,因此您可以省去它,因为它在2.0中已被弃用。 pathjust_name不再存在,您必须通过其完整路径名引用所有字段。可以很简单地重写多字段:

{
"sample": {
"_parent": {
"type": "security"
},
"properties": {
"securityDocumentId": {
"type": "keyword",
"include_in_all": false
},
"id": {
"type": "text",
"fields": {
"indexer_sample_id": {
"type": "text"
},
"id": {
"type": "text",
"include_in_all": false
}
}
},
"sampleid": {
"type": "text",
"fields": {
"sampleid": {
"type": "text",
"analyzer": "my_analyzer"
},
"sample.sampleid": {
"type": "text",
"analyzer": "my_analyzer"
},
"sample.sampleid.sort": {
"type": "text",
"analyzer": "case_insensitive_sort_analyzer"
},
"sample.sampleid.name.autocomplete": {
"type": "text",
"analyzer": "autocomplete"
}
}
},

请注意,我不确定 id子字段的有用性和附加值

关于elasticsearch - 升级到Elasticsearch 5.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43056514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com