This chapter introduces how to delete data in batches synchronously or asynchronously based on the filter condition.
curl -u shiva:shiva -XPOST 'localhost:8902/hippo/v1/_delete_by_query?pretty' -H 'Content-Type: application/json' -d'{
"database_name" : "default",
"table_name" : "book1",
"expr" : "word_count >= 11000",
"wait_for_completion" : true,
"timeout" : "2m"
}';
Result:
{
"job_id" : "166882d19e1e4274a155a0523828ebc0",
"job_status" : "SHIVA_JOB_SUCCESS",
"deleted_number" : 90,
"failed_number" : 0,
"task_results" : [
{
"id" : "5cf0fa8728e245969071b28e94bc143a",
"status" : "TASK_SUCCESS",
"server" : "192.168.0.110:27851",
"deleted_number" : 90,
"failed_number" : 0,
"execute_time" : 0.004
}
]
}
Parameter description:
Parameters | Description | Required |
---|---|---|
database_name | Database where the destination table is located | No, defaults to "default" database |
table_name | Destination table name | Yes |
expr | Filter condition when scanning data from source table | No, defaults to full table scan |
wait_for_completion | Whether to wait until the job is done | No, defaults to true |
timeout | Operation timeout | No, defaults to 5 mins |