ES定时同步数据

(cherry picked from commit ced29459af)
This commit is contained in:
梁琦涛
2023-11-28 15:34:41 +08:00
committed by mzaxd
parent 283c2d1c61
commit f9fcf4f9ee
2 changed files with 247 additions and 0 deletions
@@ -477,5 +477,19 @@ public class JeroElasticsearchTemplate {
return json;
}
/**
* 按条件删除数据
* <p>
* 请求地址:POST http://{baseUrl}/{indexName}/{typeName}/_delete_by_query
*/
public JSONObject delete(String indexName, String typeName, JSONObject queryObject) {
String url = this.getBaseUrl(indexName, typeName).append("/_delete_by_query").toString();
log.info("url:" + url + " ,delete: " + queryObject.toJSONString());
JSONObject res = RestUtil.post(url, queryObject);
log.info("url:" + url + " ,return res: \n" + res.toJSONString());
return res;
}
}