Intro Kibana Query Language For UpdateByQuery And DeleteByQuery
Intro Kibana Query Language For UpdateByQuery And DeleteByQuery
這篇介紹透過Kibana Query Language 做 UpdateByQuery Or DeleteByQuery Record。
UpdateByQuery Example:
POST table*/_update_by_query
{
“track_total_hits”:true,
“query”: {
“bool”: {
“filter”: [
{
“range”: {
“StartTime”: {
“from”: “2020/12/11 00:00:00.000”,
“to”: “2020/12/11 23:59:00.000”,
“include_upper”: true,
“include_lower”: true,
“format”: “yyyy/MM/dd HH:mm:ss.SSS”
}
}
}
],
“should”: [
{
“term”: {
“status”: {
“value”: 1
}
}
}
],
“minimum_should_match”: 1
}
},
“script”: {
“source”: “ctx._source.status=2”,
“lang”: “painless”
}
}
memo:
將StartTime符合2020/12/11 00:00:00.000 ~ 2020/12/11 23:59:00.000時間區間內 且 status = 1的資料
改成status = 2
DeleteByQuery Example:
POST table*/_delete_by_query?scroll_size=5000
{
“query”: {
“term”: {
“key”: “value”
}
}
}