RestHighLevelClient 判断索引是否存在

发布时间:2024年01月24日

前言

RestHighLevelClient 判断索引是否存在

private boolean isIndexExists(String indexName) {
    try {
    	GetIndexRequest getIndexRequest = new GetIndexRequest(indexName);
    	return restHighLevelClient.indices().exists(getIndexRequest, RequestOptions.DEFAULT);
    } catch (Exception e) {
    	log.error("check indexName occur error.", e);
    }
    return false;
}
文章来源:https://blog.csdn.net/sayyy/article/details/135830255
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。