Skip to content

Commit 82c44b7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into auto-format-java-source
2 parents 8418c15 + d6bf8e7 commit 82c44b7

File tree

1,090 files changed

+18128
-16903
lines changed

Some content is hidden

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

1,090 files changed

+18128
-16903
lines changed

.ci/bwcVersions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BWC_VERSION:
88
- "7.3.0"
99
- "7.3.1"
1010
- "7.3.2"
11+
- "7.3.3"
1112
- "7.4.0"
1213
- "7.5.0"
1314
- "8.0.0"

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ task verifyVersions {
206206
* after the backport of the backcompat code is complete.
207207
*/
208208

209-
boolean bwc_tests_enabled = true
210-
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
209+
boolean bwc_tests_enabled = false
210+
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/46534" /* place a PR link here when committing bwc changes */
211211
if (bwc_tests_enabled == false) {
212212
if (bwc_tests_disabled_issue.isEmpty()) {
213213
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/RestNoopBulkAction.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public RestNoopBulkAction(RestController controller) {
5050
controller.registerHandler(PUT, "/_noop_bulk", this);
5151
controller.registerHandler(POST, "/{index}/_noop_bulk", this);
5252
controller.registerHandler(PUT, "/{index}/_noop_bulk", this);
53-
controller.registerHandler(POST, "/{index}/{type}/_noop_bulk", this);
54-
controller.registerHandler(PUT, "/{index}/{type}/_noop_bulk", this);
5553
}
5654

5755
@Override
@@ -63,7 +61,6 @@ public String getName() {
6361
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
6462
BulkRequest bulkRequest = Requests.bulkRequest();
6563
String defaultIndex = request.param("index");
66-
String defaultType = request.param("type");
6764
String defaultRouting = request.param("routing");
6865
String defaultPipeline = request.param("pipeline");
6966

@@ -73,7 +70,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
7370
}
7471
bulkRequest.timeout(request.paramAsTime("timeout", BulkShardRequest.DEFAULT_TIMEOUT));
7572
bulkRequest.setRefreshPolicy(request.param("refresh"));
76-
bulkRequest.add(request.requiredContent(), defaultIndex, defaultType, defaultRouting,
73+
bulkRequest.add(request.requiredContent(), defaultIndex, defaultRouting,
7774
null, defaultPipeline, true, request.getXContentType());
7875

7976
// short circuit the call to the transport layer

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/RestNoopSearchAction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public RestNoopSearchAction(RestController controller) {
3535
controller.registerHandler(POST, "/_noop_search", this);
3636
controller.registerHandler(GET, "/{index}/_noop_search", this);
3737
controller.registerHandler(POST, "/{index}/_noop_search", this);
38-
controller.registerHandler(GET, "/{index}/{type}/_noop_search", this);
39-
controller.registerHandler(POST, "/{index}/{type}/_noop_search", this);
4038
}
4139

4240
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class GraphRequestConverters {
2929
private GraphRequestConverters() {}
3030

3131
static Request explore(GraphExploreRequest exploreRequest) throws IOException {
32-
String endpoint = RequestConverters.endpoint(exploreRequest.indices(), exploreRequest.types(), "_graph/explore");
32+
String endpoint = RequestConverters.endpoint(exploreRequest.indices(), "_graph/explore");
3333
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
3434
request.setEntity(RequestConverters.createEntity(exploreRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
3535
return request;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ public Cancellable flushAsync(FlushRequest flushRequest, RequestOptions options,
594594

595595
/**
596596
* Initiate a synced flush manually using the synced flush API.
597-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html#synced-flush-api">
597+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html">
598598
* Synced flush API on elastic.co</a>
599599
* @param syncedFlushRequest the request
600600
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
@@ -608,7 +608,7 @@ public SyncedFlushResponse flushSynced(SyncedFlushRequest syncedFlushRequest, Re
608608

609609
/**
610610
* Asynchronously initiate a synced flush manually using the synced flush API.
611-
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html#synced-flush-api">
611+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html">
612612
* Synced flush API on elastic.co</a>
613613
* @param syncedFlushRequest the request
614614
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,7 @@ static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) thro
544544

545545
static Request validateQuery(ValidateQueryRequest validateQueryRequest) throws IOException {
546546
String[] indices = validateQueryRequest.indices() == null ? Strings.EMPTY_ARRAY : validateQueryRequest.indices();
547-
String[] types = validateQueryRequest.types() == null || indices.length <= 0 ? Strings.EMPTY_ARRAY : validateQueryRequest.types();
548-
String endpoint = RequestConverters.endpoint(indices, types, "_validate/query");
547+
String endpoint = RequestConverters.endpoint(indices, "_validate/query");
549548
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
550549
RequestConverters.Params params = new RequestConverters.Params();
551550
params.withIndicesOptions(validateQueryRequest.indicesOptions());

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

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static Request get(GetRequest getRequest) {
266266
}
267267

268268
private static Request getStyleRequest(String method, GetRequest getRequest) {
269-
Request request = new Request(method, endpoint(getRequest.index(), getRequest.type(), getRequest.id()));
269+
Request request = new Request(method, endpoint(getRequest.index(), getRequest.id()));
270270

271271
Params parameters = new Params();
272272
parameters.withPreference(getRequest.preference());
@@ -282,13 +282,7 @@ private static Request getStyleRequest(String method, GetRequest getRequest) {
282282
}
283283

284284
static Request sourceExists(GetRequest getRequest) {
285-
String optionalType = getRequest.type();
286-
String endpoint;
287-
if (optionalType.equals(MapperService.SINGLE_MAPPING_NAME)) {
288-
endpoint = endpoint(getRequest.index(), "_source", getRequest.id());
289-
} else {
290-
endpoint = endpoint(getRequest.index(), optionalType, getRequest.id(), "_source");
291-
}
285+
String endpoint = endpoint(getRequest.index(), "_source", getRequest.id());
292286
Request request = new Request(HttpHead.METHOD_NAME, endpoint);
293287
Params parameters = new Params();
294288
parameters.withPreference(getRequest.preference());
@@ -498,15 +492,19 @@ static Request count(CountRequest countRequest) throws IOException {
498492
params.withRouting(countRequest.routing());
499493
params.withPreference(countRequest.preference());
500494
params.withIndicesOptions(countRequest.indicesOptions());
495+
if (countRequest.terminateAfter() != 0){
496+
params.withTerminateAfter(countRequest.terminateAfter());
497+
}
498+
if (countRequest.minScore() != null){
499+
params.putParam("min_score", String.valueOf(countRequest.minScore()));
500+
}
501501
request.addParameters(params.asMap());
502-
request.setEntity(createEntity(countRequest.source(), REQUEST_BODY_CONTENT_TYPE));
502+
request.setEntity(createEntity(countRequest, REQUEST_BODY_CONTENT_TYPE));
503503
return request;
504504
}
505505

506506
static Request explain(ExplainRequest explainRequest) throws IOException {
507-
String endpoint = explainRequest.type().equals(MapperService.SINGLE_MAPPING_NAME)
508-
? endpoint(explainRequest.index(), "_explain", explainRequest.id())
509-
: endpoint(explainRequest.index(), explainRequest.type(), explainRequest.id(), "_explain");
507+
String endpoint = endpoint(explainRequest.index(), "_explain", explainRequest.id());
510508
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
511509

512510
Params params = new Params();
@@ -547,6 +545,10 @@ static Request submitReindex(ReindexRequest reindexRequest) throws IOException {
547545
return prepareReindexRequest(reindexRequest, false);
548546
}
549547

548+
static Request submitDeleteByQuery(DeleteByQueryRequest deleteByQueryRequest) throws IOException {
549+
return prepareDeleteByQueryRequest(deleteByQueryRequest, false);
550+
}
551+
550552
private static Request prepareReindexRequest(ReindexRequest reindexRequest, boolean waitForCompletion) throws IOException {
551553
String endpoint = new EndpointBuilder().addPathPart("_reindex").build();
552554
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
@@ -566,6 +568,35 @@ private static Request prepareReindexRequest(ReindexRequest reindexRequest, bool
566568
return request;
567569
}
568570

571+
private static Request prepareDeleteByQueryRequest(DeleteByQueryRequest deleteByQueryRequest,
572+
boolean waitForCompletion) throws IOException {
573+
String endpoint = endpoint(deleteByQueryRequest.indices(), "_delete_by_query");
574+
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
575+
Params params = new Params()
576+
.withRouting(deleteByQueryRequest.getRouting())
577+
.withRefresh(deleteByQueryRequest.isRefresh())
578+
.withTimeout(deleteByQueryRequest.getTimeout())
579+
.withWaitForActiveShards(deleteByQueryRequest.getWaitForActiveShards())
580+
.withRequestsPerSecond(deleteByQueryRequest.getRequestsPerSecond())
581+
.withIndicesOptions(deleteByQueryRequest.indicesOptions())
582+
.withWaitForCompletion(waitForCompletion);
583+
if (deleteByQueryRequest.isAbortOnVersionConflict() == false) {
584+
params.putParam("conflicts", "proceed");
585+
}
586+
if (deleteByQueryRequest.getBatchSize() != AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE) {
587+
params.putParam("scroll_size", Integer.toString(deleteByQueryRequest.getBatchSize()));
588+
}
589+
if (deleteByQueryRequest.getScrollTime() != AbstractBulkByScrollRequest.DEFAULT_SCROLL_TIMEOUT) {
590+
params.putParam("scroll", deleteByQueryRequest.getScrollTime());
591+
}
592+
if (deleteByQueryRequest.getMaxDocs() > 0) {
593+
params.putParam("max_docs", Integer.toString(deleteByQueryRequest.getMaxDocs()));
594+
}
595+
request.addParameters(params.asMap());
596+
request.setEntity(createEntity(deleteByQueryRequest, REQUEST_BODY_CONTENT_TYPE));
597+
return request;
598+
}
599+
569600
static Request updateByQuery(UpdateByQueryRequest updateByQueryRequest) throws IOException {
570601
String endpoint = endpoint(updateByQueryRequest.indices(), "_update_by_query");
571602
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
@@ -595,30 +626,7 @@ static Request updateByQuery(UpdateByQueryRequest updateByQueryRequest) throws I
595626
}
596627

597628
static Request deleteByQuery(DeleteByQueryRequest deleteByQueryRequest) throws IOException {
598-
String endpoint = endpoint(deleteByQueryRequest.indices(), "_delete_by_query");
599-
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
600-
Params params = new Params()
601-
.withRouting(deleteByQueryRequest.getRouting())
602-
.withRefresh(deleteByQueryRequest.isRefresh())
603-
.withTimeout(deleteByQueryRequest.getTimeout())
604-
.withWaitForActiveShards(deleteByQueryRequest.getWaitForActiveShards())
605-
.withRequestsPerSecond(deleteByQueryRequest.getRequestsPerSecond())
606-
.withIndicesOptions(deleteByQueryRequest.indicesOptions());
607-
if (deleteByQueryRequest.isAbortOnVersionConflict() == false) {
608-
params.putParam("conflicts", "proceed");
609-
}
610-
if (deleteByQueryRequest.getBatchSize() != AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE) {
611-
params.putParam("scroll_size", Integer.toString(deleteByQueryRequest.getBatchSize()));
612-
}
613-
if (deleteByQueryRequest.getScrollTime() != AbstractBulkByScrollRequest.DEFAULT_SCROLL_TIMEOUT) {
614-
params.putParam("scroll", deleteByQueryRequest.getScrollTime());
615-
}
616-
if (deleteByQueryRequest.getMaxDocs() > 0) {
617-
params.putParam("max_docs", Integer.toString(deleteByQueryRequest.getMaxDocs()));
618-
}
619-
request.addParameters(params.asMap());
620-
request.setEntity(createEntity(deleteByQueryRequest, REQUEST_BODY_CONTENT_TYPE));
621-
return request;
629+
return prepareDeleteByQueryRequest(deleteByQueryRequest, true);
622630
}
623631

624632
static Request rethrottleReindex(RethrottleRequest rethrottleRequest) {
@@ -736,6 +744,10 @@ static String endpoint(String index, String type, String id) {
736744
return new EndpointBuilder().addPathPart(index, type, id).build();
737745
}
738746

747+
static String endpoint(String index, String id) {
748+
return new EndpointBuilder().addPathPart(index, "_doc", id).build();
749+
}
750+
739751
@Deprecated
740752
static String endpoint(String index, String type, String id, String endpoint) {
741753
return new EndpointBuilder().addPathPart(index, type, id).addPathPartAsIs(endpoint).build();
@@ -910,6 +922,10 @@ Params withStoredFields(String[] storedFields) {
910922
return this;
911923
}
912924

925+
Params withTerminateAfter(int terminateAfter){
926+
return putParam("terminate_after", String.valueOf(terminateAfter));
927+
}
928+
913929
Params withTimeout(TimeValue timeout) {
914930
return putParam("timeout", timeout);
915931
}

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public class RestHighLevelClient implements Closeable {
256256
private final IndexLifecycleClient ilmClient = new IndexLifecycleClient(this);
257257
private final RollupClient rollupClient = new RollupClient(this);
258258
private final CcrClient ccrClient = new CcrClient(this);
259-
private final DataFrameClient dataFrameClient = new DataFrameClient(this);
259+
private final TransformClient transformClient = new TransformClient(this);
260260

261261
/**
262262
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -472,13 +472,13 @@ public SecurityClient security() {
472472
* are shipped with the Elastic Stack distribution of Elasticsearch. All of
473473
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
474474
* <p>
475-
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/data-frame-apis.html">
476-
* Data Frame APIs on elastic.co</a> for more information.
475+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/transform-apis.html">
476+
* Transform APIs on elastic.co</a> for more information.
477477
*
478478
* @return the client wrapper for making Data Frame API calls
479479
*/
480-
public DataFrameClient dataFrame() {
481-
return dataFrameClient;
480+
public TransformClient transform() {
481+
return transformClient;
482482
}
483483

484484
/**
@@ -590,6 +590,21 @@ public final BulkByScrollResponse deleteByQuery(DeleteByQueryRequest deleteByQue
590590
);
591591
}
592592

593+
/**
594+
* Submits a delete by query task
595+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html">
596+
* Delete By Query API on elastic.co</a>
597+
* @param deleteByQueryRequest the request
598+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
599+
* @return the submission response
600+
*/
601+
public final TaskSubmissionResponse submitDeleteByQueryTask(DeleteByQueryRequest deleteByQueryRequest,
602+
RequestOptions options) throws IOException {
603+
return performRequestAndParseEntity(
604+
deleteByQueryRequest, RequestConverters::submitDeleteByQuery, options, TaskSubmissionResponse::fromXContent, emptySet()
605+
);
606+
}
607+
593608
/**
594609
* Asynchronously executes a delete by query request.
595610
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html">

0 commit comments

Comments
 (0)