gpt4 book ai didi

elasticsearch - Elasticsearch按查询删除未完成删除

转载 作者:行者123 更新时间:2023-12-02 23:49:28 24 4
gpt4 key购买 nike

我需要删除5.5 Elasticsearch集群中的大量文档。我知道执行此操作的最佳方法是在没有预期文档的情况下重建集群,但是在我们的情况下这是不可能的。我运行以下查询,该查询从集群中一部分索引中删除文档:

GET myindex_1*/doc_type/_delete_by_query
{
"query": {
"bool": {
"filter": [
{
"terms": {
"typeCode": [
"Filtered_Type"
]
}
}
],
"must": [
{
"range": {
"createdDateUTC": {
"lt": "2017-10-28"
}
}
}
]
}
}
}

它开始删除文档几个小时,但随后停止,我不得不再次开始。任何想法为什么它停止运行删除查询?

请注意,我正在使用Kibana运行查询,并且尽管我可以看到它在后端继续删除,但请求在客户端超时。

最佳答案

here:

By default _delete_by_query uses scroll batches of 1000. You can change the batch size with the scroll_size URL parameter:


POST twitter/_delete_by_query?scroll_size=5000
{
"query": {
"term": {
"user": "kimchy"
}
}
}

您可以在此处找到有关批次和批次大小的更多信息:
  • batches and requests_per_second in ElasticSearch Delete By Query API

  • 而且,由于您需要滚动浏览多个批次才能删除查询找到的所有文档,因此您可以在此处找到有关滚动的更多信息:
  • https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-request-scroll.html
  • 关于elasticsearch - Elasticsearch按查询删除未完成删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58648814/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com