Index Data into Solr Core using Postman

醉酒当歌 提交于 2019-12-12 05:29:16

问题


I have created a Solr core. Now i want to insert data into it using Postman. Can we do that and how can we insert data to solr core using Postman. Is there any REST API in Apache SOLR which can be directly called from Postman and insert data to Solr Core.

This is my JSON data which i want to insert. I am getting this exception

Exception writing document id 6 to the index; possible analysis error: For input string: \"\"","code":400}}

 [{
      "id":6,
      "AssetId": 123456,
      "Availability": "Up"
   },
   {
         "id":7,
       "AssetId": 223456,
        "Availability": "Up"
    },
   {
         "id":8,
         "AssetId": 987456,
         "Availability": "Up"
    },
   {
          "id":9,
        "AssetId": 122726,
        "Availability": "Up"

     }]

I want to insert this data to my SOLR Core names as asset. But I am getting exception.


回答1:


As you can see in the docs, you should be able to index that directly:

curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/my_collection/update' --data-binary '
[
 {
"id" : "978-0641723445",
 "cat" : ["book","hardcover"],
 "name" : "The Lightning Thief",
 "author" : "Rick Riordan",
 "series_t" : "Percy Jackson and the Olympians", 
 "sequence_i" : 1,
 "genre_s" : "fantasy",
 "inStock" : true,
 "price" : 12.50,
 "pages_i" : 384
  },
  {
  ...
  }
]'

If you need to further transform the data, you should look into this



来源:https://stackoverflow.com/questions/45562873/index-data-into-solr-core-using-postman

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!