|
21 | 21 | import org.elasticsearch.client.RestClientBuilder;
|
22 | 22 | import org.elasticsearch.client.internal.Client;
|
23 | 23 | import org.elasticsearch.common.transport.TransportAddress;
|
| 24 | +import org.elasticsearch.core.TimeValue; |
24 | 25 | import org.elasticsearch.index.query.QueryBuilders;
|
25 | 26 | import org.elasticsearch.index.reindex.DeleteByQueryRequestBuilder;
|
26 | 27 | import org.elasticsearch.plugin.nlpcn.client.ElasticsearchRestClient;
|
@@ -82,7 +83,7 @@ public static void setUp() throws Exception {
|
82 | 83 | String clusterName = nodeInfos.getClusterName().value();
|
83 | 84 | System.out.println(String.format("Found cluster... cluster name: %s", clusterName));
|
84 | 85 |
|
85 |
| - client.admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableMap.of(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false)).get(); |
| 86 | + client.admin().cluster().prepareUpdateSettings(TimeValue.ONE_MINUTE, TimeValue.ONE_MINUTE).setTransientSettings(ImmutableMap.of(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false)).get(); |
86 | 87 |
|
87 | 88 | // Load test data.
|
88 | 89 | loadBulk("src/test/resources/online.json", TEST_INDEX_ONLINE);
|
@@ -147,7 +148,7 @@ private static void createTestIndex(String index) {
|
147 | 148 | }
|
148 | 149 |
|
149 | 150 | private static void deleteTestIndex(String index) {
|
150 |
| - if(client.admin().cluster().prepareState().execute().actionGet().getState().getMetadata().hasIndex(index)){ |
| 151 | + if(client.admin().cluster().prepareState(TimeValue.ONE_MINUTE).execute().actionGet().getState().getMetadata().hasIndex(index)){ |
151 | 152 | client.admin().indices().prepareDelete(index).get();
|
152 | 153 | }
|
153 | 154 | }
|
@@ -446,7 +447,7 @@ private static TransportAddress getTransportAddress() throws UnknownHostExceptio
|
446 | 447 | }
|
447 | 448 |
|
448 | 449 | private static ElasticsearchTransport getElasticsearchTransport(RestClient restClient) {
|
449 |
| - RestClientOptions.Builder transportOptionsBuilder = new RestClientOptions(RequestOptions.DEFAULT).toBuilder(); |
| 450 | + RestClientOptions.Builder transportOptionsBuilder = new RestClientOptions(RequestOptions.DEFAULT, true).toBuilder(); |
450 | 451 |
|
451 | 452 | ContentType jsonContentType = Version.VERSION == null ? ContentType.APPLICATION_JSON
|
452 | 453 | : ContentType.create("application/vnd.elasticsearch+json",
|
|
0 commit comments