elasticSearch elk kibana _update_by_query _delete_by_query 批量修改/删除字段值

-- 根据多个条件条件 批量修改字段属性 update  elk  ctx._source.xxx 是修改字段的固定写法

POST saas_index/_update_by_query
{
  "script": {
    "source": "ctx._source.marketable='false';",
    "lang": "painless"
  },
  "query": {
  
  
     "bool": { 
      "must": [
        { "match": { "cat_id":   "1" }},
        { "match": { "store_id": "472" }}
      ]
     }
  }

}

-- 根据id  批量修改字段属性 update  elk    ctx._source.xxx 是修改字段的固定写法  xxx是需要修改的字段


POST test_index/_update_by_query
{
  "script": {
    "source": "ctx._source.marketable='false';",
    "lang": "painless"
  },
  "query": {
    "term": {
      "goods_id": {
        "value": "123126637551"
      }
    }
  }

}


 
}
-- 删除指定字段

POST test_index/_update_by_query
{
"script":{
"lang":"painless",
"inline":"ctx._source.remove(\"dept_name\")"
}
-- 根据id批量删除

POST saas_index/_delete_by_query
{

"query": {
   "ids": {
    "values": [111,22]
   }
   }
}

 

 

posted @ 2023-09-08 15:58  风中有朵云做的鱼  阅读(588)  评论(0编辑  收藏  举报