gpt4 book ai didi

elasticsearch - Elasticsearch MapperParsingException

转载 作者:行者123 更新时间:2023-12-03 00:42:20 25 4
gpt4 key购买 nike

我正在尝试将以下数据索引到elasticsearch中,

{
"_id": "5619578c1983757a72efef15",
"aseg": {},
"cs": {
"source": "None",
"ss": "In Transit",
"sr": "Weight Captured",
"act": "+B",
"pid": "BAG21678106",
"st": "UD",
"dest": "Bharatpur_DC (Rajasthan)",
"u": "J",
"sl": "Jaipur_Hub (Rajasthan)",
"ud": "2015-10-12T14:59:44.270000",
"sd": "2015-10-12T14:59:44.270000"
},

"nsl": [
{
"dt": [
2015,
10,
10
],
"code": "X-PPONM"
},
{
"dt": [
2015,
10,
11
],
"code": "X-UCI"
},
]
}

但作为返回,我得到这个错误
MapperParsingException[failed to parse [cs.nsl]]; nested: ElasticsearchIllegalArgumentException[unknown property [dt]];

我检查了映射,映射是正确的,嵌套在cs dict中的nsl与根级别的nsl具有不同的映射。
            "cs": {
"properties": {
"act": {
"type": "string"
},
"add": {
"type": "string"
},
"asr": {
"type": "string"
},
"bucket": {
"type": "string"
},
"dest": {
"type": "string",
"index": "not_analyzed"
},
"dwbn": {
"type": "string"
},
"lcld": {
"type": "string"
},
"lat": {
"type": "string"
},
"lon": {
"type": "string"
},
"loc": {
"type": "double"
},
"nsl": {
"type": "string",
"index": "not_analyzed"
},
"ntd": {
"type": "date",
"format": "dateOptionalTime"
},
"pbs": {
"type": "string"
},
"pid": {
"type": "string"
},
"pupid": {
"type": "string"
},
"sd": {
"type": "date",
"format": "dateOptionalTime"
},
"sl": {
"type": "string",
"index": "not_analyzed"
},
"source": {
"properties": {
"source": {
"type": "string"
},
"source_id": {
"type": "string"
},
"source_type": {
"type": "string"
}
}
},
"sr": {
"type": "string"
},
"ss": {
"type": "string",
"index": "not_analyzed"
},
"st": {
"type": "string"
},
"u": {
"type": "string",
"index": "not_analyzed"
},
"ud": {
"type": "date",
"format": "dateOptionalTime"
},
"vh": {
"type": "string"
}
}
},

对于根级别的nsl映射如下
        "nsl": {
"properties" : {
"code" : {
"type" : "string",
"index": "not_analyzed"
},
"dt" : {
"type" : "string",
"index": "not_analyzed"
}
}
},

这仅发生在少数几条记录上,其余所有记录都可以正常同步。
有效负载没有任何变化。
另外,nsl是cs中的稀疏键。

最佳答案

在您的映射中,nsl如下所示-

            "nsl": {
"type": "string",
"index": "not_analyzed"
},

根据映射,Elasticsearch期望对nsl字段使用具体的字符串值,但是在您提供的文档中它是一个对象数组。
Elasticsearch一旦具有映射,即确定。您不能将对象数据插入字符串字段。

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

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