spring-data-elasticsearcher : 如何使用路由删除 spring data elasticsearcher 中的文档

spring-data-elasticsearcher :How can i use route to delete document in spring data elasticsearcher

我的子文档映射是:

{
"_index": "test-index",
"_type": "test_type",
"_id": "AVznf5cOTLguhbQOC8aV",
"_version": 1,
"_score": null,
"_routing": "1b973ddd-0aa9-4578-9bf9-74125a3c7r4d",
"_parent": "1b973ddd-0aa9-4578-9bf9-74125a3c7r4d",
"_source": {
"id": null,
"email": "test@hempel.com",
"actionDate": "2017-06-20T08:43:52.000Z",
"actionStatus": "SENT_SUCCESS",
"description": "",
"ip": "0.0.0.0",
"address": "",
"browser": null,
"os": "",
"taskId": "1b973ddd-0aa9-4578-9bf9-74125a3c7f4d",
"taskName": "007",
"actionStatusName": "SENT_SUCCESS",
"new": true
},
"sort": [
"test@hempel.com"
]
}

你可以看到,它是子文档,所以每次我都这样查询文档:

test_index/test_type/AVznWID-TLguhbQOC2Zt?routing=89293986-7d08-4e73-be1e-1ec9e136b440     /Get

嗯,所以删除会像这样:

test_index/test_type/AVznWID-TLguhbQOC2Zt?routing=89293986-7d08-4e73-be1e-1ec9e136b440     /delete

但问题是,我如何使用 spring data elasticsearcher 查询和删除具有路由值的文档来完成这项工作: 弹性搜索模板

好吧,我找到了解决这个问题的方法,只需使用:

org.elasticsearch.action.delete # "DeleteRequest"

在某些情况下,我们过于依赖工具