|
@@ -1106,6 +1106,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|
|
highLevelClient().indices()::getAliasAsync);
|
|
|
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
|
|
|
assertThat(getAliasesResponse.getError(), equalTo("alias [" + alias + "] missing"));
|
|
|
+ assertThat(getAliasesResponse.getException(), nullValue());
|
|
|
}
|
|
|
createIndex(index, Settings.EMPTY);
|
|
|
client().performRequest(new Request(HttpPut.METHOD_NAME, index + "/_alias/" + alias));
|
|
@@ -1113,7 +1114,9 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|
|
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index, "non_existent_index");
|
|
|
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
|
|
|
highLevelClient().indices()::getAliasAsync);
|
|
|
+ assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
|
|
|
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
|
|
|
+ assertThat(getAliasesResponse.getError(), nullValue());
|
|
|
assertThat(getAliasesResponse.getException().getMessage(),
|
|
|
equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
|
|
|
}
|
|
@@ -1121,6 +1124,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|
|
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index, "non_existent_index").aliases(alias);
|
|
|
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
|
|
|
highLevelClient().indices()::getAliasAsync);
|
|
|
+ assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
|
|
|
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
|
|
|
assertThat(getAliasesResponse.getException().getMessage(),
|
|
|
equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
|
|
@@ -1129,13 +1133,17 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|
|
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices("non_existent_index*");
|
|
|
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
|
|
|
highLevelClient().indices()::getAliasAsync);
|
|
|
+ assertThat(getAliasesResponse.status(), equalTo(RestStatus.OK));
|
|
|
assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
|
|
|
+ assertThat(getAliasesResponse.getException(), nullValue());
|
|
|
+ assertThat(getAliasesResponse.getError(), nullValue());
|
|
|
}
|
|
|
{
|
|
|
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index).aliases(alias, "non_existent_alias");
|
|
|
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
|
|
|
highLevelClient().indices()::getAliasAsync);
|
|
|
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
|
|
|
+ assertThat(getAliasesResponse.getError(), equalTo("alias [non_existent_alias] missing"));
|
|
|
|
|
|
assertThat(getAliasesResponse.getAliases().size(), equalTo(1));
|
|
|
assertThat(getAliasesResponse.getAliases().get(index).size(), equalTo(1));
|
|
@@ -1155,6 +1163,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase {
|
|
|
}
|
|
|
*/
|
|
|
}
|
|
|
+ {
|
|
|
+ GetAliasesRequest getAliasesRequest = new GetAliasesRequest().aliases("non_existent_alias*");
|
|
|
+ GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
|
|
|
+ highLevelClient().indices()::getAliasAsync);
|
|
|
+ assertThat(getAliasesResponse.status(), equalTo(RestStatus.OK));
|
|
|
+ assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void testIndexPutSettings() throws IOException {
|