我需要更新多个solr文档,每个文档只需要更新指定的字段。我尝试了底部格式,它抛出错误
例如:
[{"add":{"doc":{"cityId":{"set":1},"id":1}}},
{"add":{"doc":{"cityId":{"set":1},"id":10}}}]
错误:
{"responseHeader":{"status":400,"QTime":0},"error":{"msg":"Error parsing JSON field value. Unexpected OBJECT_START","code":400}}
如何解决此问题
答案 0 :(得分:0)
Error parsing JSON field value. Unexpected OBJECT_START
这是因为您尝试将Array
传递给solr预期的list
。
来自Atomic updates的文件;结帐
curl http://localhost:8983/solr/update/json -H 'Content-type:application/json' -d '
{
"add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
"add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
}'