请求通过 Elasticsearch 中的 id 失败删除记录?
Request to delete record by id failure in Elasticsearch?
我正在研究Elasticsearch 5,我还没有找到删除插入其中的数据的方法。
当我查询列出记录时,elasticsearch returns this:
curl -X POST \
http://localhost:9201/usersystem/_search \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'
Return:
{
"took":1,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"skipped":0,
"failed":0
},
"hits":{
"total":1,
"max_score":1.0,
"hits":[
{
"_index":"usersystem",
"_type":"usersystem",
"_id":"951",
"_score":1.0,
"_source":{
"id":951,
"name":"User Name",
"email":"user.name@host.com",
"phone":"47-1234-9876",
"documentCode":"9876543-8",
"documentType":"RR",
"gender":"MALE",
"createdOn":"2019-07-04T20:11:47.314Z",
"updateOn":null,
"active":false,
"userId":952
}
}
]
}
}
阅读一些示例,我提出了以下 DELETE 请求 returns 错误:
要求:
curl -X DELETE \
http://localhost:9201/usersystem/_query \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'
错误:No handler found for uri [/usersystem/_query] and method [DELETE]
如何通过_id或id发起删除记录的删除请求?
让它变成这样。
curl -X DELETE http://localhost:9201/usersystem/_doc/951
如果您的搜索查询 returns 以下响应,
[
{
"_index": "usersystem",
"_type": "usersystem",
"_id": "951",
"_score": 1,
"_source": {
....
}
]
然后根据您的搜索查询的 命中 响应,我们了解到您的 index
名称为 usersystem type
用户系统。所以要通过 id 删除任何文档,你可以这样做-
DELETE /usersystem/usersystem/951
或
curl -X DELETE "localhost:9201/usersystem/usersystem/951"
查看更多: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
我在 ElasticSearch 文档中找到了关于 _delete_by_query
的内容。这是对我有用的请购单:
curl -X POST \
http://localhost:9201/usersystem/_delete_by_query \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'
我正在研究Elasticsearch 5,我还没有找到删除插入其中的数据的方法。
当我查询列出记录时,elasticsearch returns this:
curl -X POST \
http://localhost:9201/usersystem/_search \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'
Return:
{
"took":1,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"skipped":0,
"failed":0
},
"hits":{
"total":1,
"max_score":1.0,
"hits":[
{
"_index":"usersystem",
"_type":"usersystem",
"_id":"951",
"_score":1.0,
"_source":{
"id":951,
"name":"User Name",
"email":"user.name@host.com",
"phone":"47-1234-9876",
"documentCode":"9876543-8",
"documentType":"RR",
"gender":"MALE",
"createdOn":"2019-07-04T20:11:47.314Z",
"updateOn":null,
"active":false,
"userId":952
}
}
]
}
}
阅读一些示例,我提出了以下 DELETE 请求 returns 错误:
要求:
curl -X DELETE \
http://localhost:9201/usersystem/_query \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'
错误:No handler found for uri [/usersystem/_query] and method [DELETE]
如何通过_id或id发起删除记录的删除请求?
让它变成这样。
curl -X DELETE http://localhost:9201/usersystem/_doc/951
如果您的搜索查询 returns 以下响应,
[
{
"_index": "usersystem",
"_type": "usersystem",
"_id": "951",
"_score": 1,
"_source": {
....
}
]
然后根据您的搜索查询的 命中 响应,我们了解到您的 index
名称为 usersystem type
用户系统。所以要通过 id 删除任何文档,你可以这样做-
DELETE /usersystem/usersystem/951
或
curl -X DELETE "localhost:9201/usersystem/usersystem/951"
查看更多: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
我在 ElasticSearch 文档中找到了关于 _delete_by_query
的内容。这是对我有用的请购单:
curl -X POST \
http://localhost:9201/usersystem/_delete_by_query \
-d '{
"query": {
"terms": { "_id": [951] }
}
}'