Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to delete all records from Solr. I can do this in the browser by posting the following URL

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>

However I wish to do it using the commmand line. I've installed cURL and have tested that the command line understands curl commands. But when I issue the following command

curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8' 

I receive the error

< was unexpected at this time

I have tried various different variations using single or double quotes to wrap the xml in, but nothing seems to work. Can anybody shed any light?

Thanks in advance.

share|improve this question

2 Answers

up vote 1 down vote accepted

Here is an example of how to delete a solr index with curl:

https://gist.github.com/nz/673027

For windows, check this out:

How to post XML data with cURL using cmd in windows 7?

share|improve this answer
 
Thanks, but this still yields the same error. –  Linda Keating Jul 19 at 18:20
 
What OS are you on? What shell, if on unix? Do you have wget available? –  aet Jul 19 at 18:24
 
Seems like you might be on windows. Could you try " around the xml instead of '? –  aet Jul 19 at 18:32
 
Hi I'm using Windows 7 and the command prompt and no I haven't heard of wget before? –  Linda Keating Jul 19 at 18:32
 
I thought I had tried that already, but I tried it again, and this time it worked. Thankyou! –  Linda Keating Jul 19 at 18:37

Try these parameters

commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.