Rick Hodder
Rick Hodder

Reputation: 2252

Clearing SOLR 7.1 index

I have been using SOLR 4.10.2, and am getting ready to migrate to 7.1

Under 4.10.2 I was able to clear an index with the following:

var address = @"http://mysolrserver:8983/solr/mysolrcore/update?stream.body=<delete><query>(*:*)</query></delete>&commit=true";

WebClient client = new WebClient();
client.DownloadString(address).Dump();

When I try this against a SOLR 7.1 server, I get a response 400 - Bad request.

{
  "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}}

I went into solrconfig.xml for the core and set the element to

<requestParsers enableRemoteStreaming="true" 
                multipartUploadLimitInKB="2048000"
                formdataUploadLimitInKB="2048"
                addHttpRequestToContext="false"/>

but I still get the same error.

Since 7.1 is now json by default, I have tried adding

&wt=xml

to the end of the url, but I get the same result: 400 - Bad Request

Any ideas?

Upvotes: 0

Views: 792

Answers (2)

Raju Paladiya
Raju Paladiya

Reputation: 818

I run below call in postman, after deleting query working fine.

http://localhost:8983/solr/CORENAME/config -H 'Content-type:application/json' -d'{
    "set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true},
    "set-property" : {"requestDispatcher.requestParsers.enableStreamBody":true}
}'

Upvotes: 1

MatsLindh
MatsLindh

Reputation: 52822

You're switching the wrong parameter. If you want to allow stream.body in the URL, you have to set enableStreamBody="true". enableRemoteStreaming controls stream.file and stream.url which can be used to read from remote locations.

Upvotes: 2

Related Questions