使用默认的UpdateRequestHandler发布到solr 4.10时,收到以下错误:
org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: Error parsing JSON field value. Unexpected OBJECT_START
作为一个例子,我发送以下json:
[
{
"add": {
"doc": {
"key": "ph2gi6i8",
"p_profit_tf": "22.248070175438603",
"p_discount_tf": "18.771929824561404",
"p_designer_s": "POP CANDY"
},
"overwrite": true
}
}
]
这是基于此处solr文档中的示例架构:https://wiki.apache.org/solr/UpdateJSON
schema.xml中配置的唯一必填字段是关键字段
答案 0 :(得分:2)
您不能在数组中传递它,而是通过换行符分隔的对象:
{
"add": {
"doc": {
"key": "ph2gi6i8",
"p_profit_tf": "22.248070175438603",
"p_discount_tf": "18.771929824561404",
"p_designer_s": "POP CANDY"
},
"overwrite": true
}
}
{
"add": {
"doc": {
"key": "ph2gi6i8",
"p_profit_tf": "22.248070175438603",
"p_discount_tf": "18.771929824561404",
"p_designer_s": "POP CANDY"
},
"overwrite": true
}
}