0

I want to save data to es, but before save operation, i need always check whether or not the index exists; because the restHighLevelClient's bulk method never throws any exception about IndexNotFoundException; therefore it will make performance lower.

Is there any way to catch the IndexNofFoundException with restHighLevelClient SDK?

Thanks for all kind of you

Piotr Niewinski
  • 1,298
  • 2
  • 15
  • 27

1 Answers1

0

Why not check if the index exist before putting the request in the bulk request?

final boolean exists = restHighLevelClient.indices().exists(new GetIndexRequest(indexName), RequestOptions.DEFAULT);

Or you could check the message of the potential exceptions if they contain the literal text "index_not_found_exception"