user3387677
user3387677

Reputation: 47

HTTP Error 405 method post is not supported by this URL error accessing solr/index.html

Im new to Solr and im trying to index a json document from the command line, but for learning, i tried curl to post a simple json data to my collection. Im facing the following error:

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

I have very little knowledge about collections and cores as im a newbie, pls do let me know what is causing this error.. Thanks!

Upvotes: 0

Views: 3993

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

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

That's an Admin UI URL for the web-browser with update handler appended. The correct URL base is /solr/collectionname/updatehandler. So, it would be more like:

http://localhost:8983/solr/mycollection/update/json/docs

Also, the command bin/post exists to make posting things easier and it has built-in help for the flags to indicate what kind of JSON (custom or Solr UPDATE format) you are sending.

Upvotes: 4

Related Questions