es版本
es7.10
判断该索引是否存在
private RestHighLevelClient client;
// 判断该索引是否存在
public boolean isExistsIndex(string index) {
GetIndexRequest indexRequest = new GetIndexRequest(index);
boolean exists = false;
try {
exists = client.indices().exists(indexRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
e.printStackTrace();
}
return exists;
}