3

I have setup apache solr 7.1 and using postman tool to query it. But when I am trying to delete indexed data using postman I get following error.

Request:

GET http://localhost:8983/solr/solr-sample3/update?stream.body={
    "delete": {
        "query": "*:*"
    },
    "commit": { }
}

Body:

{
    "error": {
        "metadata": [
            "error-class",
            "org.apache.solr.common.SolrException",
            "root-error-class",
            "org.apache.solr.common.SolrException"
        ],
        "msg": "Stream Body is disabled. See http://lucene.apache.org/solr/guide/requestdispatcher-in-solrconfig.html for help",
        "code": 400
    }
}

It was working in previous solr version solr 6.6. I went through the lucene documentation but I am not able to figure it out.

saket satpute
  • 177
  • 3
  • 13

3 Answers3

8

You don't need to enable the stream body. Just use a curl POST request specifying the data type as text/xml

curl http://localhost:8983/solr/solr-sample3/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

Or if you're using the Post Tool included in solr:

bin/post -c core_name -type text/xml -out yes -d $'<delete><query>*:*</query></delete>'
Yashveer Rana
  • 548
  • 3
  • 15
7

I went though the documentation, it says i need to enable stream body as it has been disabled in solr 7.1 .

to enable use :

curl http://localhost:8983/solr/solr-sample3/config -H 'Content-type:application/json' -d'{
    "set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true},
    "set-property" : {"requestDispatcher.requestParsers.enableStreamBody":true}
}'
saket satpute
  • 177
  • 3
  • 13
5

Here is what worked for me, using cURL and avoiding to enable stream body:

curl http://localhost:8983/solr/solr-sample3/update?commit=true -X POST -H "Content-Type: text/xml" --data-binary "<delete><query>*:*</query></delete>"
user2173353
  • 4,316
  • 4
  • 47
  • 79