|
21 | 21 |
|
22 | 22 | import org.apache.http.Header; |
23 | 23 | import org.elasticsearch.action.ActionListener; |
| 24 | +import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; |
| 25 | +import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; |
24 | 26 | import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; |
25 | 27 | import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; |
26 | 28 | import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; |
27 | | -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; |
28 | | -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; |
29 | 29 | import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; |
30 | 30 | import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; |
31 | 31 | import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; |
|
34 | 34 | import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; |
35 | 35 | import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; |
36 | 36 | import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; |
| 37 | +import org.elasticsearch.action.admin.indices.shrink.ResizeRequest; |
| 38 | +import org.elasticsearch.action.admin.indices.shrink.ResizeResponse; |
37 | 39 |
|
38 | 40 | import java.io.IOException; |
39 | 41 |
|
@@ -208,4 +210,48 @@ public void existsAliasAsync(GetAliasesRequest getAliasesRequest, ActionListener |
208 | 210 | restHighLevelClient.performRequestAsync(getAliasesRequest, Request::existsAlias, RestHighLevelClient::convertExistsResponse, |
209 | 211 | listener, emptySet(), headers); |
210 | 212 | } |
| 213 | + |
| 214 | + /** |
| 215 | + * Shrinks an index using the Shrink Index API |
| 216 | + * <p> |
| 217 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html"> |
| 218 | + * Shrink Index API on elastic.co</a> |
| 219 | + */ |
| 220 | + public ResizeResponse shrink(ResizeRequest resizeRequest, Header... headers) throws IOException { |
| 221 | + return restHighLevelClient.performRequestAndParseEntity(resizeRequest, Request::shrink, ResizeResponse::fromXContent, |
| 222 | + emptySet(), headers); |
| 223 | + } |
| 224 | + |
| 225 | + /** |
| 226 | + * Asynchronously shrinks an index using the Shrink index API |
| 227 | + * <p> |
| 228 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html"> |
| 229 | + * Shrink Index API on elastic.co</a> |
| 230 | + */ |
| 231 | + public void shrinkAsync(ResizeRequest resizeRequest, ActionListener<ResizeResponse> listener, Header... headers) { |
| 232 | + restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, Request::shrink, ResizeResponse::fromXContent, |
| 233 | + listener, emptySet(), headers); |
| 234 | + } |
| 235 | + |
| 236 | + /** |
| 237 | + * Splits an index using the Split Index API |
| 238 | + * <p> |
| 239 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html"> |
| 240 | + * Shrink Index API on elastic.co</a> |
| 241 | + */ |
| 242 | + public ResizeResponse split(ResizeRequest resizeRequest, Header... headers) throws IOException { |
| 243 | + return restHighLevelClient.performRequestAndParseEntity(resizeRequest, Request::split, ResizeResponse::fromXContent, |
| 244 | + emptySet(), headers); |
| 245 | + } |
| 246 | + |
| 247 | + /** |
| 248 | + * Asynchronously splits an index using the Split Index API |
| 249 | + * <p> |
| 250 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-split-index.html"> |
| 251 | + * Split Index API on elastic.co</a> |
| 252 | + */ |
| 253 | + public void splitAsync(ResizeRequest resizeRequest, ActionListener<ResizeResponse> listener, Header... headers) { |
| 254 | + restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, Request::split, ResizeResponse::fromXContent, |
| 255 | + listener, emptySet(), headers); |
| 256 | + } |
211 | 257 | } |
0 commit comments