I'm deleting documents from browser URL.
I'm using Solr-7.4.0
I'm using this query for delete document
http://localhost:8983/solr/test/update?stream.body=<delete><query>*:*</query></delete>&commit=true
This is return below error message.
{
"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 also tried with
http://localhost:8983/solr/test/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
but not get any luck. This return below message:
{
"responseHeader":{
"status":0,
"QTime":1}}
but documents not deleting.
I'm using DIH for import data.
my data-config.xml file is
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://127.0.0.1\SQL2017;databaseName=mydatabase" user="sa" password="mypassword"/>
<document>
<entity name="Product"
pk="Id"
query="select Id, [Name] from Product"
deltaImportQuery="SELECT Id, [Name] from Product WHERE Id='${dih.delta.id}'"
deltaQuery="SELECT Id FROM Product WHERE updated_at > '${dih.last_index_time}'"
>
<field column="Id" name="Id"/>
<field column="Name" name="Name"/>
</entity>
</document>
</dataConfig>
I fixed it by postman
Method: POST Content-Type: application/json Body:
{
"set-property": [{
"requestDispatcher.requestParsers.enableRemoteStreaming": true
},
{
"requestDispatcher.requestParsers.enableStreamBody": true
}
]
}
URL: http://localhost:8983/api/cores/test5/config
after that run below URL:
http://localhost:8983/solr/test5/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
and it's working fine.
Another way is to open the solrconfig.xml file and edit it directly.
The default value should look like this:
<requestParsers enableRemoteStreaming="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
We need to add the enableStreamBody attribute:
<requestParsers enableRemoteStreaming="true"
enableStreamBody="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
Just remember to reload the collection in Solr so the changes will be applied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With