Solr 错误 - 流体被禁用
Solr error - Stream Body is disabled
我正在从浏览器中删除文档 URL。
我正在使用 Solr-7.4.0
我正在使用此查询删除文档
http://localhost:8983/solr/test/update?stream.body=<delete><query>*:*</query></delete>&commit=true
这是 return 下面的错误消息。
{
"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}}
我也试过
http://localhost:8983/solr/test/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
但运气不好。
此 return 下面的消息:
{
"responseHeader":{
"status":0,
"QTime":1}}
但是文件没有删除。
我正在使用 DIH 导入数据。
我的数据-config.xml文件是
<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>
我找邮递员修好了
方法: POST
内容类型: application/json
正文:
{
"set-property": [{
"requestDispatcher.requestParsers.enableRemoteStreaming": true
},
{
"requestDispatcher.requestParsers.enableStreamBody": true
}
]
}
URL: http://localhost:8983/api/cores/test5/config
之后 运行 下面 URL:
http://localhost:8983/solr/test5/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
并且工作正常。
另一种方法是打开solrconfig.xml文件直接编辑
默认值应如下所示:
<requestParsers enableRemoteStreaming="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
我们需要添加enableStreamBody属性:
<requestParsers enableRemoteStreaming="true"
enableStreamBody="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
请记住在 Solr 中重新加载集合,以便应用更改。
我正在从浏览器中删除文档 URL。
我正在使用 Solr-7.4.0
我正在使用此查询删除文档
http://localhost:8983/solr/test/update?stream.body=<delete><query>*:*</query></delete>&commit=true
这是 return 下面的错误消息。
{
"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}}
我也试过
http://localhost:8983/solr/test/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
但运气不好。 此 return 下面的消息:
{
"responseHeader":{
"status":0,
"QTime":1}}
但是文件没有删除。
我正在使用 DIH 导入数据。
我的数据-config.xml文件是
<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>
我找邮递员修好了
方法: POST 内容类型: application/json 正文:
{
"set-property": [{
"requestDispatcher.requestParsers.enableRemoteStreaming": true
},
{
"requestDispatcher.requestParsers.enableStreamBody": true
}
]
}
URL: http://localhost:8983/api/cores/test5/config
之后 运行 下面 URL:
http://localhost:8983/solr/test5/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true
并且工作正常。
另一种方法是打开solrconfig.xml文件直接编辑
默认值应如下所示:
<requestParsers enableRemoteStreaming="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
我们需要添加enableStreamBody属性:
<requestParsers enableRemoteStreaming="true"
enableStreamBody="true"
multipartUploadLimitInKB="2048000"
formdataUploadLimitInKB="2048"
addHttpRequestToContext="false"/>
请记住在 Solr 中重新加载集合,以便应用更改。