27

Just trying to delete all the documents, and did this:

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E

then committed:

http://localhost:8983/solr/update?stream.body=%3Ccommit/%3E

I get the response:

<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">17</int>
</lst>
</response>

But when I search I still get results back.

What did I do wrong?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
  • where is the solr log, I couldn't find it! I'm running on jetty. – Blankman Mar 02 '10 at 17:49
  • Never mind, if you have a response, there's no error. What's your client platform? If it's Java you could just use SolrJ, or is there any particular reason you're not using it? – Mauricio Scheffer Mar 02 '10 at 22:07
  • what docs do you get if you query `*:*` ? – Karussell Jun 05 '10 at 19:26
  • 3
    If anyone is wondering, here is the SOLR docs on how to do these kind of deletions from a URL: http://wiki.apache.org/solr/UpdateXmlMessages – Aaron D Aug 10 '10 at 17:11
  • For me this did not help, but be sure check the linked issue: http://stackoverflow.com/questions/12057734/solr-cannot-delete-anything – Cedric Meury Sep 25 '12 at 15:02

7 Answers7

32

Not sure if it matters but you might encode the : too

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*%3A*%3C%2Fquery%3E%3C%2Fdelete%3E

Another thing to try is to use the POST method (the preferred way to call update):

curl http://localhost:8983/solr/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
mlathe
  • 2,375
  • 1
  • 23
  • 42
9

I got stung with this one recently as well. Just remember that if you have updateLog is configured in solrconfig.xml, but there is no version field in the schema.xml

see https://issues.apache.org/jira/browse/SOLR-3432

I Spent a good hour on this one!!!

Rob
  • 1,663
  • 1
  • 19
  • 16
6

Put the commit=true parameter in you GET request:

http://localhost:8983/solr/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true

Tim P
  • 948
  • 1
  • 12
  • 19
2

Remember to clear the browser cache! I thought I was having the same problem, but it turned out that the browser had just cached the result and was returning the cached page. D'oh!

Pete
  • 21
  • 1
0

In Lucene wiki :

it will still be found, because index changes are not visible until, and a new searcher is opened. To cause this to happen, send a commit command to Solr (post.jar does this for you by default)

Maybe you can POST a <commit/> message to Solr.

Juampa
  • 154
  • 1
  • 7
0
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
Tyler Liu
  • 19,552
  • 11
  • 100
  • 84
-2

Probably you are missing a forward slash (/) after update and before question mark.

Current query:

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

Revised query:

http://localhost:8983/solr/update/?stream.body=<delete><query>*:*</query></delete>&commit=true
Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44