Ryan Eom
Ryan Eom

Reputation: 387

solr: curl delete command silently fails

I am trying to delete all data before reindexing. Here is my command (I am on windows):

curl -X POST -H "Content-Type: application/json" --data-binary "{\"delete\":{\"query\":\"*:*\" }}" http://localhost:8983/solr/mycollection/update

I get a successful response, but the data is still there afterwards. What could be the problem?

Upvotes: 1

Views: 143

Answers (1)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8658

Your curl command is missing the commit=true

Please use the below command with commit in it.

curl -X POST -H 'Content-Type: application/json' \
    'http://<host>:<port>/solr/<core>/update?commit=true' \
    -d '{ "delete": {"query":"*:*"} }'

If you are using the curl on the windows then it would be like

curl -X POST -H "Content-Type: application/json" --data-binary "{\"delete\":{\"query\":\"*:*\" }}" "http://localhost:8983/solr/mycollection/update?commit=true"

Below one can be used through browser :

http://host:port/solr/collection_name/update?commit=true&stream.body=<delete><query>*:*</query></delete>

Upvotes: 2

Related Questions