访问solr / index.html

时间:2017-03-12 11:01:27

标签: curl solr http-post solrcloud

我是Solr的新手,我试图从命令行索引json文档,但是为了学习,我尝试使用curl将简单的json数据发布到我的集合中。我面临以下错误:

C:\Users\MJ\Downloads\solr-6.4.1\bin>curl -X POST -H 'Content-

Type:application/json' "http://localhost:8983/solr/#/~collections/mycollection/update/json/docs" --data-binary ' {"id":"1","title":"doc1"}'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 405 HTTP method POST is not supported by this URL</title>
</head>
<body><h2>HTTP ERROR 405</h2>
<p>Problem accessing /solr/index.html. Reason:
<pre>    HTTP method POST is not supported by this URL</pre></p>
</body>
</html>

[1/2]: id:1' --> <stdout>
--_curl_--id:1'
curl: (6) Couldn't resolve host 'id'

[2/2]: title:doc1' --> <stdout>
--_curl_--title:doc1'
curl: (3) Illegal port number

我对收藏和核心知之甚少,因为我是新手,请告诉我导致此错误的原因..谢谢!

1 个答案:

答案 0 :(得分:2)

  

http://localhost:8983/solr/#/~collections/mycollection/update/json/docs

这是附加了更新处理程序的Web浏览器的Admin UI URL。正确的网址是 / solr / collectionname / updatehandler 。所以,它更像是:

<强> http://localhost:8983/solr/mycollection/update/json/docs

此外,命令 bin / post 的存在使发布更容易,并且内置的标志帮助指示您要发送的JSON(自定义或Solr UPDATE格式)类型。