Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot post to a core in solr using SimplePostTool

Tags:

solr

I am new to using solr. I currently have solr running on http://localhost::8983/solr. My goal is to index numerous files. I have verified that the core I'm trying to post to exists by listing all cores in solr,I used the method explained here

I also understand that to post to a specific core using SimplePostTool, one must use java -Durl=http://localhost:8983/solr/<corename>/update -jar post.jar <filename>

The issue, however, is that I get the following error.

SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/collection1/update using content-type application/xml..
POSTing file tmpzWztTN
SimplePostTool: WARNING: Solr returned an error #404 Not Found
SimplePostTool: WARNING: IOException while reading response: java.io.FileNotFoundException: http://localhost:8983/solr/collection1/update
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/collection1/update..
SimplePostTool: WARNING: Solr returned an error #404 Not Found for url http://localhost:8983/solr/collection1/update?commit=true
Time spent: 0:00:00.023

Since I have verified that the core, collection1, exists, why does it say the url cannot be found? What am i missing? How does one fix this?

like image 863
Adeeb Avatar asked Mar 11 '14 16:03

Adeeb


3 Answers

It looks like gettingstarted core is not being created. Create 'gettingstarted' core with this command.

bin/solr create -c gettingstarted

Once the core is created bin/post -c gettingstarted docs/ command runs without any error.

like image 73
Ramesh Pabbati Avatar answered Nov 05 '22 17:11

Ramesh Pabbati


As in @cheffe's comment, it turns out I was missing <requestHandler> name="/update" ...

I am a solr noob so I looked up requestHandlers's here. This tutorial was also helpful. In essense, I only added the following line in my solrconfig.xml file

<requestHandler name="/update" class="solr.UpdateRequestHandler" />
like image 27
Adeeb Avatar answered Nov 05 '22 15:11

Adeeb


Confirmation, this actually worked for me [Win10, solr 5.4.1, java 1.8.0_60]:

$ java -Dauto -Dc=gettingstarted -Drecursive -jar example/exampledocs/post.jar  docs/quickstart.html

resulted into … HTTP ERROR 404 url … as above, I did as recommended:

$ .\bin\solr create -c gettingstarted

& then

$ java -Dauto -Dc=gettingstarted -Drecursive -jar example/exampledocs/post.jar  .\docs

worked for me. Thanks.

like image 2
J Bordag Avatar answered Nov 05 '22 17:11

J Bordag