如何通过Solr管理文档页面添加多个JSON文档?
我试过json:
[
{
"id" : "001",
"name" : "Ram",
"age" : 53,
"Designation" : "Manager",
"Location" : "Hyderabad",
},
{
"id" : "002",
"name" : "Robert",
"age" : 43,
"Designation" : "SR.Programmer",
"Location" : "Chennai",
},
{
"id" : "003",
"name" : "Rahim",
"age" : 25,
"Designation" : "JR.Programmer",
"Location" : "Delhi",
}
]
单击“提交文档”后,将返回错误:
状态:错误 错误:错误请求 “msg”:“预期:OBJECT_START但在[16]处获得了ARRAY_START”, “代码”:400
答案 0 :(得分:3)
删除[]括号,这对我有用。
{
"id" : "001",
"name" : "Ram",
"age" : 53,
"Designation" : "Manager",
"Location" : "Hyderabad"
},
{
"id" : "002",
"name" : "Robert",
"age" : 43,
"Designation" : "SR.Programmer",
"Location" : "Chennai"
},
{
"id" : "003",
"name" : "Rahim",
"age" : 25,
"Designation" : "JR.Programmer",
"Location" : "Delhi"
}
答案 1 :(得分:0)
答案 2 :(得分:0)
最后,从海得拉巴,金奈和德里卸下方括号和。 会起作用
答案 3 :(得分:0)
从下拉列表中选择“ JSON” ...这仅接受要添加的单个JSON文档,因为它将这样的标签包裹在其中...
{
"add": {
"doc": YOUR_TEXT_AREA_INPUT,
"boost": BOOST_FORM_INPUT,
"overwrite": CHECKBOX_INPUT,
"commitWithin": COMMIT_WITHIN_FORM_INPUT
}
}
您应该选择“ Solr命令(原始XML或JSON)”,如下所示:
{
"add":{
"doc":{
"product_catalog_name": "123",
"product_price": 80,
"product_name": "a",
"id": "33998",
"product_picture": "2014032417271233.png"
}
},
"add":{
"doc":{
"product_catalog_name": "123",
"product_price": 100,
"product_name": "b",
"id": "33999",
"product_picture": "2014032417271233.png"
}
}
}