zoukankan      html  css  js  c++  java
  • ES 7.7.1 高效delete_by_query

    index中数据量很大的时候会出现接口超时的情况,另外也会出现version conflict等问题。根据ES


    参考文档

    https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-delete-by-query.html


    1.delete by query

    POST /user_profile_daily/_delete_by_query?conflicts=proceed&scroll_size=10000&wait_for_completion=false
    {
      "query": {
       "bool": {
          "filter": [
            { "term": { "recordType": "video"   }}
          ],
          "must_not": [
            {"exists": {"field":"startAt"}
          }]
        }
      }
    }


    2./_task?detailed查看任务状态

    GET /_tasks?detailed=true&actions=*/delete/byquery


    3./_task/_cancel取消任务

    POST /_tasks/_cancel?actions=*/delete/byquery


    4.sql语句统计剩余条数

    GET _sql?format=csv
    {
      "query": """
      select count(*)  from user_profile_daily where recordType='video' and startAt is not null limit 10
      """
    }

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的【推荐】。
    如果,您希望更容易地发现我的新博客,不妨点击一下左下角的【关注我】。
    如果,您对我的博客所讲述的内容有兴趣,请继续关注我的后续博客,我是【Arli】。

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Python的logging模块
    Python中的json模块
    Python的re模块
    NoSQL简介
    单例设计模式
    基于配置文件的方式配置AOP
    重用切点表达式
    切面优先级
    返回通知、异常通知、环绕通知
    后置通知
  • 原文地址:https://www.cnblogs.com/arli/p/15186309.html
Copyright © 2011-2022 走看看