使用solr索引json文件

时间:2017-05-14 22:53:55

标签: json indexing solr

我能够使用solr索引一个简单的JSON,但对于具有嵌套结构的复杂JSON,我收到错误。我使用curl命令使用solr索引JSON文件:

curl 'https://localhost:8983/solr/json_collection/update?commit=true' --data-binary @/home/mic.json -H 'Content-type:application/json'

错误:

  

错误 - {" responseHeader":{" status":400," QTime":12},"错误":{& #34;元数据":["误差级"" org.apache.solr.common.SolrException&#34]," MSG":&#34 ;解析JSON字段值时出错。意外的OBJECT_START","代码":400}}

JSON:

[
  {
    "PART I, ITEM 1. BUSINESS": {
      "GENERAL": {
        "Our vision": {
          "text": [
            "Microsoft world."
          ]
        },
        "The ambitions that drive us": {
          "text": [
            "To carry ambitions:",
            "* Create more personal computing."
          ],
          "Create more personal computing": {
            "text": [
              "We strive  available. website."
            ]
          }
        }
      },
      "ITEM 1A. RISK FACTORS": "Our opk."
    }
  }
]

Error

JSON

1 个答案:

答案 0 :(得分:0)

你的JSON似乎是错误的。在任何一种情况下,单个对象或JSON数组,您的JSON应遵循基本约定。

对于单个对象,语法应为 -

{ "key":"value"}

如果是JSON数组,语法可以是 -

{
"key1":["value1", "value2",...],
"key2":["value12", "value22",...]
}