'ExistsRequest'에 해당되는 글 1건

  1. 2022.09.13 [7.17.x] ExistsRequest - 인덱스 존재여부 조회
엘라스틱서치2022. 9. 13. 17:26

# Deprecated된 RestHighLevelClient를 대체하기 위해 ElasticsearchClient를 활용.

 

 ExistsRequest existsRequest = new ExistsRequest.Builder().index(index).build();
  try {
    BooleanResponse response = client.indices().exists(existsRequest);
    return response.value();
  } catch (IOException e) {
    return false;
  }
}

 

※ 참고. 매개변수는 다음과 같이 List 또는 String 타입

public final Builder index(List<String> list) {
  this.index = _listAddAll(this.index, list);
  return this;
}

public final Builder index(String value, String... values) {
  this.index = _listAdd(this.index, value, values);
  return this;
}
Posted by 홍규홍규