我收到错误“以[。]开头或结尾的对象字段使对象解析变得模糊:[]”。但是我的对象中没有一个点[。]。使用elasticClient.update()
我正在传递:
{
"index": "applicants",
"type": "applicant",
"id": "A01gfGEBKfWmu0nhvuR7",
"body": {
"doc": {
"phsEmploymentHistory": {
"numSickDaysNotIll": "4",
"employers": [{
"employmentType": {},
"": {},
"name": null,
"supervisor": null,
"contactNumber": null,
"extension": null,
"email": null,
"coworker1": null,
"coworker2": null,
"duties": null,
"jobTitle": null,
"reasonLeaving": null,
"fullTime": null,
"partTime": null,
"temp": null,
"selfEmployed": null,
"volunteer": null,
"duration": {
"startDate": null,
"endDate": null
},
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"agencies": [{
"": {},
"agencyName": null,
"backgroundInvestigator": null,
"contactNumber": null,
"extension": null,
"position": null,
"email": null,
"stepsCompleted": null,
"dateApplied": null,
"status": null,
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"disciplined": {
"response": false,
"explanation": ""
},
"warnedDrugs": {
"response": false,
"explanation": ""
},
"valid": true
}
}
}
}
我已经好几次了。我不认为错误信息是足够的。 “对象解析模糊:[]”似乎暗示我有一个空数组,但我没有。
答案 0 :(得分:2)
json的值可以为空。但是,如果键为空,则ES在索引时会引发错误。
从json中删除"":{}
并再次索引。