Skip to content

Commit c6f8af7

Browse files
committed
Merge remote-tracking branch 'elastic/master' into simplify-retention-lease-expiration
* elastic/master: (24 commits) Add support for API keys to access Elasticsearch (elastic#38291) Add typless client side GetIndexRequest calls and response class (elastic#37778) Limit token expiry to 1 hour maximum (elastic#38244) add docs saying mixed-cluster ILM is not supported (elastic#37954) Skip unsupported languages for tests (elastic#38328) Deprecate `_type` in simulate pipeline requests (elastic#37949) Mute testCannotShrinkLeaderIndex (elastic#38374) Tighten mapping syncing in ccr remote restore (elastic#38071) Add test for `PutFollowAction` on a closed index (elastic#38236) Fix SSLContext pinning to TLSV1.2 in reload tests (elastic#38341) Mute RareClusterStateIT.testDelayedMappingPropagationOnReplica (elastic#38357) Deprecate types in rollover index API (elastic#38039) Types removal - fix FullClusterRestartIT warning expectations (elastic#38310) Fix ILM explain response to allow unknown fields (elastic#38054) Mute testFollowIndexAndCloseNode (elastic#38360) Docs: Drop inline callout from scroll example (elastic#38340) Deprecate HLRC security methods (elastic#37883) Remove types from Monitoring plugin "backend" code (elastic#37745) Add Composite to AggregationBuilders (elastic#38207) Clarify slow cluster-state log messages (elastic#38302) ...
2 parents 760dfe3 + fe36861 commit c6f8af7

File tree

235 files changed

+13406
-1506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+13406
-1506
lines changed

client/rest-high-level/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ integTestCluster {
104104
setting 'xpack.license.self_generated.type', 'trial'
105105
setting 'xpack.security.enabled', 'true'
106106
setting 'xpack.security.authc.token.enabled', 'true'
107+
setting 'xpack.security.authc.api_key.enabled', 'true'
107108
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
108109
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
109110
setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java

Lines changed: 143 additions & 23 deletions
Large diffs are not rendered by default.

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@
3333
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
3434
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
3535
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
36-
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
37-
import org.elasticsearch.client.indices.GetFieldMappingsRequest;
3836
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
3937
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
40-
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
4138
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
4239
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
4340
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
@@ -46,12 +43,15 @@
4643
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
4744
import org.elasticsearch.client.indices.CreateIndexRequest;
4845
import org.elasticsearch.client.indices.FreezeIndexRequest;
46+
import org.elasticsearch.client.indices.GetFieldMappingsRequest;
47+
import org.elasticsearch.client.indices.GetIndexRequest;
4948
import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
5049
import org.elasticsearch.client.indices.GetMappingsRequest;
5150
import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
5251
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
5352
import org.elasticsearch.client.indices.PutMappingRequest;
5453
import org.elasticsearch.client.indices.UnfreezeIndexRequest;
54+
import org.elasticsearch.client.indices.rollover.RolloverRequest;
5555
import org.elasticsearch.common.Strings;
5656

5757
import java.io.IOException;
@@ -148,6 +148,10 @@ static Request putMapping(PutMappingRequest putMappingRequest) throws IOExceptio
148148
return request;
149149
}
150150

151+
/**
152+
* converter for the legacy server-side {@link org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest} that still supports
153+
* types
154+
*/
151155
@Deprecated
152156
static Request putMapping(org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest) throws IOException {
153157
// The concreteIndex is an internal concept, not applicable to requests made over the REST API.
@@ -339,7 +343,7 @@ private static Request resize(ResizeRequest resizeRequest) throws IOException {
339343

340344
static Request rollover(RolloverRequest rolloverRequest) throws IOException {
341345
String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getAlias()).addPathPartAsIs("_rollover")
342-
.addPathPart(rolloverRequest.getNewIndexName()).build();
346+
.addPathPart(rolloverRequest.getNewIndexName()).build();
343347
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
344348

345349
RequestConverters.Params params = new RequestConverters.Params(request);
@@ -354,6 +358,25 @@ static Request rollover(RolloverRequest rolloverRequest) throws IOException {
354358
return request;
355359
}
356360

361+
@Deprecated
362+
static Request rollover(org.elasticsearch.action.admin.indices.rollover.RolloverRequest rolloverRequest) throws IOException {
363+
String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getAlias()).addPathPartAsIs("_rollover")
364+
.addPathPart(rolloverRequest.getNewIndexName()).build();
365+
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
366+
367+
RequestConverters.Params params = new RequestConverters.Params(request);
368+
params.withTimeout(rolloverRequest.timeout());
369+
params.withMasterTimeout(rolloverRequest.masterNodeTimeout());
370+
params.withWaitForActiveShards(rolloverRequest.getCreateIndexRequest().waitForActiveShards());
371+
if (rolloverRequest.isDryRun()) {
372+
params.putParam("dry_run", Boolean.TRUE.toString());
373+
}
374+
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
375+
request.setEntity(RequestConverters.createEntity(rolloverRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
376+
377+
return request;
378+
}
379+
357380
static Request getSettings(GetSettingsRequest getSettingsRequest) {
358381
String[] indices = getSettingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.indices();
359382
String[] names = getSettingsRequest.names() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.names();
@@ -370,6 +393,28 @@ static Request getSettings(GetSettingsRequest getSettingsRequest) {
370393
return request;
371394
}
372395

396+
/**
397+
* converter for the legacy server-side {@link org.elasticsearch.action.admin.indices.get.GetIndexRequest} that
398+
* still supports types
399+
*/
400+
@Deprecated
401+
static Request getIndex(org.elasticsearch.action.admin.indices.get.GetIndexRequest getIndexRequest) {
402+
String[] indices = getIndexRequest.indices() == null ? Strings.EMPTY_ARRAY : getIndexRequest.indices();
403+
404+
String endpoint = RequestConverters.endpoint(indices);
405+
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
406+
407+
RequestConverters.Params params = new RequestConverters.Params(request);
408+
params.withIndicesOptions(getIndexRequest.indicesOptions());
409+
params.withLocal(getIndexRequest.local());
410+
params.withIncludeDefaults(getIndexRequest.includeDefaults());
411+
params.withHuman(getIndexRequest.humanReadable());
412+
params.withMasterTimeout(getIndexRequest.masterNodeTimeout());
413+
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
414+
415+
return request;
416+
}
417+
373418
static Request getIndex(GetIndexRequest getIndexRequest) {
374419
String[] indices = getIndexRequest.indices() == null ? Strings.EMPTY_ARRAY : getIndexRequest.indices();
375420

@@ -386,6 +431,28 @@ static Request getIndex(GetIndexRequest getIndexRequest) {
386431
return request;
387432
}
388433

434+
/**
435+
* converter for the legacy server-side {@link org.elasticsearch.action.admin.indices.get.GetIndexRequest} that
436+
* still supports types
437+
*/
438+
@Deprecated
439+
static Request indicesExist(org.elasticsearch.action.admin.indices.get.GetIndexRequest getIndexRequest) {
440+
// this can be called with no indices as argument by transport client, not via REST though
441+
if (getIndexRequest.indices() == null || getIndexRequest.indices().length == 0) {
442+
throw new IllegalArgumentException("indices are mandatory");
443+
}
444+
String endpoint = RequestConverters.endpoint(getIndexRequest.indices(), "");
445+
Request request = new Request(HttpHead.METHOD_NAME, endpoint);
446+
447+
RequestConverters.Params params = new RequestConverters.Params(request);
448+
params.withLocal(getIndexRequest.local());
449+
params.withHuman(getIndexRequest.humanReadable());
450+
params.withIndicesOptions(getIndexRequest.indicesOptions());
451+
params.withIncludeDefaults(getIndexRequest.includeDefaults());
452+
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
453+
return request;
454+
}
455+
389456
static Request indicesExist(GetIndexRequest getIndexRequest) {
390457
// this can be called with no indices as argument by transport client, not via REST though
391458
if (getIndexRequest.indices() == null || getIndexRequest.indices().length == 0) {
@@ -417,11 +484,11 @@ static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) thr
417484
}
418485

419486
/**
420-
* @deprecated This uses the old form of PutIndexTemplateRequest which uses types.
487+
* @deprecated This uses the old form of PutIndexTemplateRequest which uses types.
421488
* Use (@link {@link #putTemplate(PutIndexTemplateRequest)} instead
422489
*/
423490
@Deprecated
424-
static Request putTemplate(org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest)
491+
static Request putTemplate(org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest)
425492
throws IOException {
426493
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
427494
.addPathPart(putIndexTemplateRequest.name()).build();
@@ -484,11 +551,11 @@ static Request getAlias(GetAliasesRequest getAliasesRequest) {
484551
static Request getTemplatesWithDocumentTypes(GetIndexTemplatesRequest getIndexTemplatesRequest) {
485552
return getTemplates(getIndexTemplatesRequest, true);
486553
}
487-
554+
488555
static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest) {
489556
return getTemplates(getIndexTemplatesRequest, false);
490557
}
491-
558+
492559
private static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest, boolean includeTypeName) {
493560
final String endpoint = new RequestConverters.EndpointBuilder()
494561
.addPathPartAsIs("_template")
@@ -502,7 +569,7 @@ private static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRe
502569
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
503570
}
504571
return request;
505-
}
572+
}
506573

507574
static Request templatesExist(IndexTemplatesExistRequest indexTemplatesExistRequest) {
508575
final String endpoint = new RequestConverters.EndpointBuilder()

0 commit comments

Comments
 (0)