gpt4 book ai didi

elasticsearch - 更新现有索引上映射的属性

转载 作者:行者123 更新时间:2023-12-02 22:46:13 31 4
gpt4 key购买 nike

具有此映射:

curl -XPUT 'http://myip:9200/test?pretty' -d'
{
"mappings": {
"items": {
"dynamic": "strict",
"properties" : {
"title" : { "type": "string" },
"body" : { "type": "string" },
"publish_up" : { "type": "date",
"format" : "yyyy-MM-dd HH:mm:ss",
"copy_to": "publication_date"},
"publication_date" : { "type": "date",
"format" : "yyyy-MM-dd HH:mm:ss"},

}}}}'

我想将属性 publication_date更改为 "store" : "yes",以便返回值 using fields。这是我的尝试:
curl -X PUT 'http://myip:9200/test/_mapping/items?ignore_conflicts=true' -d '{
"items": {
"properties": {
"publication_date": {
"type": "date",
"format" : "yyyy-MM-dd HH:mm:ss",
"store" : "yes"
}}}}'

但是我得到了错误

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Mapper for [publication_date] conflicts with existing mapping in other types:\n[mapper [publication_date] has different [store] values]"}],"type":"illegal_argument_exception","reason":"Mapper for [publication_date] conflicts with existing mapping in other types:\n[mapper [publication_date] has different [store] values]"},"status":400}



有什么帮助吗?提前致谢。

PS:我正在使用ES 2.3

最佳答案

一旦将文档写入ES(ES 2以上版本),就无法更新映射。

由于更改映射将意味着使已建立索引的文档失效,因此您需要使用正确的映射创建新索引,然后将数据重新索引到该索引中。

关于elasticsearch - 更新现有索引上映射的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44178581/

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