Skip to content

Commit

Permalink
[Test] Add client param indexExists
Browse files Browse the repository at this point in the history
This allows us to use the admin client to easily check whether an
index exists (that may not be visible to the standard client)
  • Loading branch information
tvernum committed Oct 21, 2024
1 parent 22b4d81 commit f2e24f0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,11 @@ protected Map<String, Object> getIndexMappingAsMap(String index) throws IOExcept
}

protected static boolean indexExists(String index) throws IOException {
Response response = client().performRequest(new Request("HEAD", "/" + index));
return indexExists(client(), index);
}

protected static boolean indexExists(RestClient client, String index) throws IOException {
Response response = client.performRequest(new Request("HEAD", "/" + index));
return RestStatus.OK.getStatus() == response.getStatusLine().getStatusCode();
}

Expand Down

0 comments on commit f2e24f0

Please sign in to comment.