sak*_*ute 3 lucene solr postman
我已经设置了apache solr 7.1并使用postman工具进行查询.但是当我尝试使用邮递员删除索引数据时,我得到以下错误.
请求:
GET http://localhost:8983/solr/solr-sample3/update?stream.body={
"delete": {
"query": "*:*"
},
"commit": { }
}
Run Code Online (Sandbox Code Playgroud)
身体:
{
"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
}
}
Run Code Online (Sandbox Code Playgroud)
它在以前的solr版本solr 6.6中工作.我浏览了lucene文档,但我无法弄明白.
您不需要启用流体.只需使用curl POST请求,将数据类型指定为text/xml
curl http://localhost:8983/solr/solr-sample3/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
或者,如果您使用的是solr中包含的Post Tool:
bin/post -c core_name -type text/xml -out yes -d $'<delete><query>*:*</query></delete>'
Run Code Online (Sandbox Code Playgroud)
我查阅了文档,它说我需要启用流主体,因为它已在solr 7.1中禁用。
启用使用:
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}
}'
Run Code Online (Sandbox Code Playgroud)
这是对我有用的方法,使用 cURL 并避免启用流主体:
curl http://localhost:8983/solr/solr-sample3/update?commit=true -X POST -H "Content-Type: text/xml" --data-binary "<delete><query>*:*</query></delete>"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4714 次 |
| 最近记录: |