|
29 | 29 | import org.apache.http.HttpHost;
|
30 | 30 | import org.assertj.core.util.Lists;
|
31 | 31 | import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
| 32 | +import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; |
32 | 33 | import org.elasticsearch.action.get.GetRequest;
|
33 | 34 | import org.elasticsearch.action.index.IndexRequest;
|
34 | 35 | import org.elasticsearch.client.RequestOptions;
|
@@ -87,6 +88,20 @@ public void tearDown() {
|
87 | 88 | client.indices().delete(new DeleteIndexRequest("*"), RequestOptions.DEFAULT);
|
88 | 89 | }
|
89 | 90 |
|
| 91 | + @Test |
| 92 | + @SneakyThrows |
| 93 | + public void testIndexSettingOnCreateIndex() { |
| 94 | + val indexSetting = "{\"index.number_of_shards\":3,\"index.number_of_replicas\":2}"; |
| 95 | + val req = new CreateResolvableIndexRequest(ENTITY_VALUE, TYPE_VALUE, "sd", "kkde23", "re", false, indexSetting); |
| 96 | + val newResolvedIndex = service.createResolvableIndex(req); |
| 97 | + val getSettingsReq = new GetSettingsRequest().indices(newResolvedIndex.getIndexName()); |
| 98 | + val resp = client.indices().getSettings(getSettingsReq, RequestOptions.DEFAULT); |
| 99 | + val replicasNum = Integer.valueOf(resp.getSetting(newResolvedIndex.getIndexName(), "index.number_of_replicas")); |
| 100 | + val shardNum = Integer.valueOf(resp.getSetting(newResolvedIndex.getIndexName(), "index.number_of_shards")); |
| 101 | + assertThat(shardNum).isEqualTo(3); |
| 102 | + assertThat(replicasNum).isEqualTo(2); |
| 103 | + } |
| 104 | + |
90 | 105 | @Test
|
91 | 106 | public void testIndexCreationAndUpdatedRelease() {
|
92 | 107 | // create new index, an index with the parameters already exists so it should create index with updated release value
|
|
0 commit comments