Search in sources :

Example 1 with GetIndicesSettingsRequest

use of org.opensearch.client.opensearch.indices.GetIndicesSettingsRequest in project opensearch-java by opensearch-project.

the class IndicesClientIT method testGetSettingsNonExistentIndex.

public void testGetSettingsNonExistentIndex() throws IOException {
    String nonExistentIndex = "index_that_doesnt_exist";
    GetIndicesSettingsRequest getIndicesSettingsRequest = new GetIndicesSettingsRequest.Builder().index(nonExistentIndex).build();
    try {
        highLevelClient().indices().getSettings(getIndicesSettingsRequest);
        fail();
    } catch (OpenSearchException ex) {
        assertNotNull(ex);
        assertEquals(ex.status(), 404);
        assertEquals(ex.getMessage(), "Request failed: [index_not_found_exception] " + "no such index [index_that_doesnt_exist]");
    }
}
Also used : GetIndicesSettingsRequest(org.opensearch.client.opensearch.indices.GetIndicesSettingsRequest) OpenSearchException(org.opensearch.client.opensearch._types.OpenSearchException)

Aggregations

OpenSearchException (org.opensearch.client.opensearch._types.OpenSearchException)1 GetIndicesSettingsRequest (org.opensearch.client.opensearch.indices.GetIndicesSettingsRequest)1