/**
* 异步批量删除
*
* @param indexName
* @param typeName
* @param ids
* @return isSucceeded
* @throws IOException
*/
public boolean delete(String indexName, String typeName, Set<Object> ids) throws IOException {
JestClient jestClient = getJestClient();
final AtomicBoolean isSucceeded = new AtomicBoolean();
int count = 0;
Bulk.Builder bulk = new Bulk.Builder().defaultIndex(indexName).defaultType(typeName);
for (Object id : ids) {
if (count > batch) {
jestClient.executeAsync(bulk.build(), new JestResultHandler<BulkResult>() {
@Override
public void completed(BulkResult result) {
synchronized (isSucceeded) {
isSucceeded.set(result.isSucceeded());
}
}
@Override
public
Jest 异步根据文档ID进行批量删除
最新推荐文章于 2022-09-09 16:58:12 发布