ES定时同步数据

This commit is contained in:
梁琦涛
2023-11-27 19:04:11 +08:00
parent fc684156d4
commit ced29459af
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;
}
}