|
55 | 55 | import org.elasticsearch.client.indices.DeleteAliasRequest; |
56 | 56 | import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest; |
57 | 57 | import org.elasticsearch.client.indices.DetailAnalyzeResponse; |
58 | | -import org.elasticsearch.client.indices.FreezeIndexRequest; |
| 58 | +import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest; |
| 59 | +import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse; |
59 | 60 | import org.elasticsearch.client.indices.GetFieldMappingsRequest; |
60 | 61 | import org.elasticsearch.client.indices.GetFieldMappingsResponse; |
61 | 62 | import org.elasticsearch.client.indices.GetIndexRequest; |
62 | 63 | import org.elasticsearch.client.indices.GetIndexResponse; |
63 | | -import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest; |
64 | 64 | import org.elasticsearch.client.indices.GetIndexTemplatesRequest; |
65 | 65 | import org.elasticsearch.client.indices.GetIndexTemplatesResponse; |
66 | | -import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse; |
67 | 66 | import org.elasticsearch.client.indices.GetMappingsRequest; |
68 | 67 | import org.elasticsearch.client.indices.GetMappingsResponse; |
69 | 68 | import org.elasticsearch.client.indices.IndexTemplateMetadata; |
70 | 69 | import org.elasticsearch.client.indices.IndexTemplatesExistRequest; |
71 | 70 | import org.elasticsearch.client.indices.PutComponentTemplateRequest; |
72 | | -import org.elasticsearch.client.indices.PutIndexTemplateRequest; |
73 | 71 | import org.elasticsearch.client.indices.PutComposableIndexTemplateRequest; |
| 72 | +import org.elasticsearch.client.indices.PutIndexTemplateRequest; |
74 | 73 | import org.elasticsearch.client.indices.PutMappingRequest; |
75 | 74 | import org.elasticsearch.client.indices.ReloadAnalyzersRequest; |
76 | 75 | import org.elasticsearch.client.indices.ReloadAnalyzersResponse; |
|
90 | 89 | import org.elasticsearch.common.unit.ByteSizeUnit; |
91 | 90 | import org.elasticsearch.common.unit.ByteSizeValue; |
92 | 91 | import org.elasticsearch.core.TimeValue; |
93 | | -import org.elasticsearch.xcontent.XContentBuilder; |
94 | | -import org.elasticsearch.xcontent.XContentFactory; |
95 | | -import org.elasticsearch.xcontent.XContentType; |
96 | 92 | import org.elasticsearch.index.IndexSettings; |
97 | 93 | import org.elasticsearch.index.query.QueryBuilder; |
98 | 94 | import org.elasticsearch.index.query.QueryBuilders; |
99 | 95 | import org.elasticsearch.rest.RestStatus; |
| 96 | +import org.elasticsearch.xcontent.XContentBuilder; |
| 97 | +import org.elasticsearch.xcontent.XContentFactory; |
| 98 | +import org.elasticsearch.xcontent.XContentType; |
100 | 99 |
|
101 | 100 | import java.io.IOException; |
102 | 101 | import java.util.Collections; |
|
108 | 107 | import java.util.concurrent.TimeUnit; |
109 | 108 |
|
110 | 109 | import static org.elasticsearch.client.IndicesClientIT.FROZEN_INDICES_DEPRECATION_WARNING; |
111 | | -import static org.elasticsearch.client.IndicesClientIT.IGNORE_THROTTLED_DEPRECATION_WARNING; |
112 | 110 | import static org.elasticsearch.client.IndicesClientIT.LEGACY_TEMPLATE_OPTIONS; |
113 | 111 | import static org.hamcrest.Matchers.containsInAnyOrder; |
114 | 112 | import static org.hamcrest.Matchers.equalTo; |
@@ -2874,89 +2872,6 @@ public void onFailure(Exception e) { |
2874 | 2872 |
|
2875 | 2873 | } |
2876 | 2874 |
|
2877 | | - public void testFreezeIndex() throws Exception { |
2878 | | - RestHighLevelClient client = highLevelClient(); |
2879 | | - |
2880 | | - { |
2881 | | - CreateIndexResponse createIndexResponse = client.indices().create(new CreateIndexRequest("index"), RequestOptions.DEFAULT); |
2882 | | - assertTrue(createIndexResponse.isAcknowledged()); |
2883 | | - } |
2884 | | - |
2885 | | - { |
2886 | | - // tag::freeze-index-request |
2887 | | - FreezeIndexRequest request = new FreezeIndexRequest("index"); // <1> |
2888 | | - // end::freeze-index-request |
2889 | | - |
2890 | | - // tag::freeze-index-request-timeout |
2891 | | - request.setTimeout(TimeValue.timeValueMinutes(2)); // <1> |
2892 | | - // end::freeze-index-request-timeout |
2893 | | - // tag::freeze-index-request-masterTimeout |
2894 | | - request.setMasterTimeout(TimeValue.timeValueMinutes(1)); // <1> |
2895 | | - // end::freeze-index-request-masterTimeout |
2896 | | - // tag::freeze-index-request-waitForActiveShards |
2897 | | - request.setWaitForActiveShards(ActiveShardCount.DEFAULT); // <1> |
2898 | | - // end::freeze-index-request-waitForActiveShards |
2899 | | - |
2900 | | - // tag::freeze-index-request-indicesOptions |
2901 | | - request.setIndicesOptions(IndicesOptions.strictExpandOpen()); // <1> |
2902 | | - // end::freeze-index-request-indicesOptions |
2903 | | - |
2904 | | - final RequestOptions freezeIndexOptions = RequestOptions.DEFAULT.toBuilder() |
2905 | | - .setWarningsHandler( |
2906 | | - warnings -> List.of(FROZEN_INDICES_DEPRECATION_WARNING, IGNORE_THROTTLED_DEPRECATION_WARNING).equals(warnings) == false |
2907 | | - ).build(); |
2908 | | - |
2909 | | - // tag::freeze-index-execute |
2910 | | - ShardsAcknowledgedResponse openIndexResponse = client.indices().freeze(request, freezeIndexOptions); |
2911 | | - // end::freeze-index-execute |
2912 | | - |
2913 | | - // tag::freeze-index-response |
2914 | | - boolean acknowledged = openIndexResponse.isAcknowledged(); // <1> |
2915 | | - boolean shardsAcked = openIndexResponse.isShardsAcknowledged(); // <2> |
2916 | | - // end::freeze-index-response |
2917 | | - assertTrue(acknowledged); |
2918 | | - assertTrue(shardsAcked); |
2919 | | - |
2920 | | - // tag::freeze-index-execute-listener |
2921 | | - ActionListener<ShardsAcknowledgedResponse> listener = |
2922 | | - new ActionListener<ShardsAcknowledgedResponse>() { |
2923 | | - @Override |
2924 | | - public void onResponse(ShardsAcknowledgedResponse freezeIndexResponse) { |
2925 | | - // <1> |
2926 | | - } |
2927 | | - |
2928 | | - @Override |
2929 | | - public void onFailure(Exception e) { |
2930 | | - // <2> |
2931 | | - } |
2932 | | - }; |
2933 | | - // end::freeze-index-execute-listener |
2934 | | - |
2935 | | - // Replace the empty listener by a blocking listener in test |
2936 | | - final CountDownLatch latch = new CountDownLatch(1); |
2937 | | - listener = new LatchedActionListener<>(listener, latch); |
2938 | | - |
2939 | | - // tag::freeze-index-execute-async |
2940 | | - client.indices().freezeAsync(request, RequestOptions.DEFAULT, listener); // <1> |
2941 | | - // end::freeze-index-execute-async |
2942 | | - |
2943 | | - assertTrue(latch.await(30L, TimeUnit.SECONDS)); |
2944 | | - } |
2945 | | - |
2946 | | - { |
2947 | | - // tag::freeze-index-notfound |
2948 | | - try { |
2949 | | - FreezeIndexRequest request = new FreezeIndexRequest("does_not_exist"); |
2950 | | - client.indices().freeze(request, RequestOptions.DEFAULT); |
2951 | | - } catch (ElasticsearchException exception) { |
2952 | | - if (exception.status() == RestStatus.BAD_REQUEST) { |
2953 | | - // <1> |
2954 | | - } |
2955 | | - } |
2956 | | - // end::freeze-index-notfound |
2957 | | - } |
2958 | | - } |
2959 | | - |
2960 | 2875 | public void testUnfreezeIndex() throws Exception { |
2961 | 2876 | RestHighLevelClient client = highLevelClient(); |
2962 | 2877 |
|
|
0 commit comments