Muhzin
Muhzin

Reputation: 67

Solr delete statement error

I'm trying out solr...I get the following error when trying a delete query:

 curl http://localhost:8983/solr/update --data-binary '<delete><id>SP2514N</id></delete>'

the error is:

Error 400 missing content stream  
Problem accessing /solr/update. Reason: missing content stream

Upvotes: 1

Views: 2142

Answers (2)

javanna
javanna

Reputation: 60205

The other answer seems correct but doesn't explain the reason. You only need to change the content type you're using to text/xml, otherwise curl uses the default application/x-www-form-urlencoded with the --data-binary option (or -d).

You should use the following command:

curl -H 'Content-Type: text/xml' http://localhost:8983/solr/update --data-binary '<delete><id>SP2514N</id></delete>'

You might want to add the commit=true parameter to the url to immediately issue a commit, otherwise you'll still see the document you wanted to delete (until the next commit).

You can also pass the xml directly within the url via GET like suggested in the other answer, using the stream.body parameter.

Upvotes: 4

Jayendra
Jayendra

Reputation: 52779

Use : -

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

Upvotes: 0

Related Questions