Advertisement

清理数据——筑梦之路

阅读量:

此处主要采用了elasticsearch所提供的相关接口

复制代码
复制代码
 # 清理指定时间之前的数据

    
  
    
 curl -X POST "http://localhost:9200/[索引名]/_delete_by_query?pretty&wait_for_completion=false" -H 'Content-Type: application/json' -d '
    
  {
    
    "query": {
    
      "range": {
    
    "[时间日期字段]": {
    
      "lt": "2024-03-31 00:00:00"
    
    }
    
      }
    
    }
    
  }
    
  '
    
  
    
 此处在后台运行,响应结果示例:
    
 {
    
  
    
 "took" : 3686,
    
  
    
 "timed_out" : false,
    
  
    
 "total" : 117666,
    
  
    
 "deleted" : 117666,
    
  
    
 "batches" : 118,
    
  
    
 "version_confl

全部评论 (0)

还没有任何评论哟~