gpt4 book ai didi

elasticsearch - Elastic Search不允许我索引先前设置为false的新模板版本中的字段

转载 作者:行者123 更新时间:2023-12-03 01:21:54 24 4
gpt4 key购买 nike

我有一个包含很多字段的模板,下面是一个简短的示例。

{
"index_patterns": "test*",
"order": 2,
"version": 2,
"aliases": {
"tests": {

}
},
"settings": {
"number_of_shards": 5,
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [

],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"dynamic": "false",
"properties": {
"id": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"emailAddress": {
"enabled": false
},
"createdTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"updatedTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"createdDate": {
"type": "date"
},
"updatedDate": {
"type": "date"
}
}
}
}

字段 emailAddress设置为 enabled=false,我们需要使其可搜索,因此我们需要更改模板并像 id字段一样设置此字段类型和规范化器。然后放入模板,并将数据从索引 test-2重新索引到索引 test-4
{
"index_patterns": "test*",
"order": 4,
"version": 4,
"aliases": {
"tests": {

}
},
"settings": {
"number_of_shards": 5,
"analysis": {
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [

],
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"dynamic": "false",
"properties": {
"id": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"emailAddress": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
},
"createdTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"updatedTimestampEpochInMilliseconds": {
"type": "date",
"format": "epoch_millis"
},
"createdDate": {
"type": "date"
},
"updatedDate": {
"type": "date"
}
}
}
}

当尝试使用Elastic Search ReindexOnServer重新索引或手动查询数据并从一个索引移到另一个索引时,我们会收到 400 Bad Request错误。
{
"index": "test-4",
"type": "_doc",
"id": "54e1ea11-d7b4-4310-90f1-11ddbecc4d21",
"cause": {
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Mapping definition for [emailAddress] has unsupported parameters: [enabled : false]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [emailAddress] has unsupported parameters: [enabled : false]"
}
},
"status": 400
}

错误消息有点令人困惑,更改模板版本应使用最新的模板自动创建索引,并遵守新的字段索引类型和规范化器。
不知道我在这里想念什么。

最佳答案

我将删除旧模板,因为它对您不再有用。 version字段仅供引用,ES不使用。

这是因为order设置导致两个模板都启动并且最新模板(v4)覆盖了旧模板(v2)。但是,不再支持enabled设置,这会导致此错误。如果删除较旧的模板,就可以了。

关于elasticsearch - Elastic Search不允许我索引先前设置为false的新模板版本中的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59989216/

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