我想通过Elasticsearch中的单个查询删除一些文档。我正在使用弹性2.3.5版本。
我知道有一个'delete-by-query'
插件,但是它只在Elasticsearch 2.3.4 ver之前有效(如果我在这里错了,请纠正我)。我尝试在我的环境中安装插件,但失败了。
C:\elastic search\elasticsearch-2.3.5\bin>plugin install delete-by-query --verbo
se
-> Installing delete-by-query...
Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugi
n/delete-by-query/2.3.5/delete-by-query-2.3.5.zip ...
Failed: SSLException[Received fatal alert: protocol_version]
ERROR: failed to download out of all possible locations..., use --verbose to get
detailed information
以下是我在'jobs_index'
中可用的数据-
{
"_index": "jobs_index",
"_type": "jobs_doc",
"_id": "1",
"_score": 1,
"_source": {
"source_job_id": "1888027",
"specialty": "ICU",
"profession": "RN",
"created_date": "2019-10-10T08:30:00.000Z"
}
},
{
"_index": "jobs_index",
"_type": "jobs_doc",
"_id": "2",
"_score": 1,
"_source": {
"source_job_id": "1888030",
"specialty": "ICU2",
"profession": "RN",
"created_date": "2019-10-11T07:30:00.000Z"
}
},
{
"_index": "jobs_index",
"_type": "jobs_doc",
"_id": "3",
"_score": 1,
"_source": {
"source_job_id": "1888030",
"specialty": "ICU2",
"profession": "RN",
"created_date": "2019-10-11T07:30:00.000Z"
}
},
{
"_index": "jobs_index",
"_type": "jobs_doc",
"_id": "4",
"_score": 1,
"_source": {
"source_job_id": "1888029",
"specialty": "ICU2",
"profession": "RN",
"created_date": "2019-10-10T07:30:00.000Z"
}
}
我要删除'created_date'
少于“ 2019-10-11”的记录。
相同的GET请求看起来像-
GET /jobs_index/jobs_doc/_search
{
"query": {
"range": {
"created_date": {
"lte": "now-1d"
}
}
}
}
有人可以为此提供一些建议吗?