Skip to content

Commit 85ad27e

Browse files
committed
Merge remote-tracking branch 'es/master' into enrich
2 parents 6b0cfb5 + 58c62c5 commit 85ad27e

File tree

168 files changed

+2691
-590
lines changed

Some content is hidden

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

168 files changed

+2691
-590
lines changed

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ slf4j = 1.6.2
2121
# when updating the JNA version, also update the version in buildSrc/build.gradle
2222
jna = 4.5.1
2323

24-
netty = 4.1.38.Final
24+
netty = 4.1.42.Final
2525
joda = 2.10.3
2626

2727
# when updating this version, you need to ensure compatibility with:

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

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
import org.elasticsearch.client.ccr.ForgetFollowerRequest;
3131
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
3232
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
33+
import org.elasticsearch.client.ccr.PauseAutoFollowPatternRequest;
3334
import org.elasticsearch.client.ccr.PauseFollowRequest;
3435
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
3536
import org.elasticsearch.client.ccr.PutFollowRequest;
3637
import org.elasticsearch.client.ccr.PutFollowResponse;
38+
import org.elasticsearch.client.ccr.ResumeAutoFollowPatternRequest;
3739
import org.elasticsearch.client.ccr.ResumeFollowRequest;
3840
import org.elasticsearch.client.ccr.UnfollowRequest;
3941
import org.elasticsearch.client.core.AcknowledgedResponse;
@@ -410,6 +412,92 @@ public Cancellable getAutoFollowPatternAsync(GetAutoFollowPatternRequest request
410412
);
411413
}
412414

415+
/**
416+
* Pauses an auto follow pattern.
417+
*
418+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html">
419+
* the docs</a> for more.
420+
*
421+
* @param request the request
422+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
423+
* @return the response
424+
* @throws IOException in case there is a problem sending the request or parsing back the response
425+
*/
426+
public AcknowledgedResponse pauseAutoFollowPattern(PauseAutoFollowPatternRequest request, RequestOptions options) throws IOException {
427+
return restHighLevelClient.performRequestAndParseEntity(
428+
request,
429+
CcrRequestConverters::pauseAutoFollowPattern,
430+
options,
431+
AcknowledgedResponse::fromXContent,
432+
Collections.emptySet()
433+
);
434+
}
435+
436+
/**
437+
* Asynchronously pauses an auto follow pattern.
438+
*
439+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-auto-follow-pattern.html">
440+
* the docs</a> for more.
441+
* @param request the request
442+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
443+
* @param listener the listener to be notified upon request completion
444+
* @return cancellable that may be used to cancel the request
445+
*/
446+
public Cancellable pauseAutoFollowPatternAsync(PauseAutoFollowPatternRequest request,
447+
RequestOptions options,
448+
ActionListener<AcknowledgedResponse> listener) {
449+
return restHighLevelClient.performRequestAsyncAndParseEntity(
450+
request,
451+
CcrRequestConverters::pauseAutoFollowPattern,
452+
options,
453+
AcknowledgedResponse::fromXContent,
454+
listener,
455+
Collections.emptySet());
456+
}
457+
458+
/**
459+
* Resumes an auto follow pattern.
460+
*
461+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html">
462+
* the docs</a> for more.
463+
*
464+
* @param request the request
465+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
466+
* @return the response
467+
* @throws IOException in case there is a problem sending the request or parsing back the response
468+
*/
469+
public AcknowledgedResponse resumeAutoFollowPattern(ResumeAutoFollowPatternRequest request, RequestOptions options) throws IOException {
470+
return restHighLevelClient.performRequestAndParseEntity(
471+
request,
472+
CcrRequestConverters::resumeAutoFollowPattern,
473+
options,
474+
AcknowledgedResponse::fromXContent,
475+
Collections.emptySet()
476+
);
477+
}
478+
479+
/**
480+
* Asynchronously resumes an auto follow pattern.
481+
*
482+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-auto-follow-pattern.html">
483+
* the docs</a> for more.
484+
* @param request the request
485+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
486+
* @param listener the listener to be notified upon request completion
487+
* @return cancellable that may be used to cancel the request
488+
*/
489+
public Cancellable resumeAutoFollowPatternAsync(ResumeAutoFollowPatternRequest request,
490+
RequestOptions options,
491+
ActionListener<AcknowledgedResponse> listener) {
492+
return restHighLevelClient.performRequestAsyncAndParseEntity(
493+
request,
494+
CcrRequestConverters::resumeAutoFollowPattern,
495+
options,
496+
AcknowledgedResponse::fromXContent,
497+
listener,
498+
Collections.emptySet());
499+
}
500+
413501
/**
414502
* Gets all CCR stats.
415503
*

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import org.elasticsearch.client.ccr.FollowStatsRequest;
3030
import org.elasticsearch.client.ccr.ForgetFollowerRequest;
3131
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
32+
import org.elasticsearch.client.ccr.PauseAutoFollowPatternRequest;
3233
import org.elasticsearch.client.ccr.PauseFollowRequest;
3334
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
3435
import org.elasticsearch.client.ccr.PutFollowRequest;
36+
import org.elasticsearch.client.ccr.ResumeAutoFollowPatternRequest;
3537
import org.elasticsearch.client.ccr.ResumeFollowRequest;
3638
import org.elasticsearch.client.ccr.UnfollowRequest;
3739

@@ -118,6 +120,24 @@ static Request getAutoFollowPattern(GetAutoFollowPatternRequest getAutoFollowPat
118120
return new Request(HttpGet.METHOD_NAME, endpoint);
119121
}
120122

123+
static Request pauseAutoFollowPattern(PauseAutoFollowPatternRequest pauseAutoFollowPatternRequest) throws IOException {
124+
String endpoint = new RequestConverters.EndpointBuilder()
125+
.addPathPartAsIs("_ccr", "auto_follow")
126+
.addPathPart(pauseAutoFollowPatternRequest.getName())
127+
.addPathPartAsIs("pause")
128+
.build();
129+
return new Request(HttpPost.METHOD_NAME, endpoint);
130+
}
131+
132+
static Request resumeAutoFollowPattern(ResumeAutoFollowPatternRequest resumeAutoFollowPatternRequest) throws IOException {
133+
String endpoint = new RequestConverters.EndpointBuilder()
134+
.addPathPartAsIs("_ccr", "auto_follow")
135+
.addPathPart(resumeAutoFollowPatternRequest.getName())
136+
.addPathPartAsIs("resume")
137+
.build();
138+
return new Request(HttpPost.METHOD_NAME, endpoint);
139+
}
140+
121141
static Request getCcrStats(CcrStatsRequest ccrStatsRequest) {
122142
String endpoint = new RequestConverters.EndpointBuilder()
123143
.addPathPartAsIs("_ccr", "stats")

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

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import org.elasticsearch.client.slm.GetSnapshotLifecycleStatsRequest;
4444
import org.elasticsearch.client.slm.GetSnapshotLifecycleStatsResponse;
4545
import org.elasticsearch.client.slm.PutSnapshotLifecyclePolicyRequest;
46+
import org.elasticsearch.client.slm.SnapshotLifecycleManagementStatusRequest;
47+
import org.elasticsearch.client.slm.StartSLMRequest;
48+
import org.elasticsearch.client.slm.StopSLMRequest;
4649

4750
import java.io.IOException;
4851

@@ -541,4 +544,102 @@ public Cancellable getSnapshotLifecycleStatsAsync(GetSnapshotLifecycleStatsReque
541544
return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::getSnapshotLifecycleStats,
542545
options, GetSnapshotLifecycleStatsResponse::fromXContent, listener, emptySet());
543546
}
547+
548+
/**
549+
* Start the Snapshot Lifecycle Management feature.
550+
* See <pre>
551+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
552+
* java-rest-high-ilm-slm-start-slm.html
553+
* </pre> for more.
554+
* @param request the request
555+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
556+
* @return the response
557+
* @throws IOException in case there is a problem sending the request or parsing back the response
558+
*/
559+
public AcknowledgedResponse startSLM(StartSLMRequest request, RequestOptions options) throws IOException {
560+
return restHighLevelClient.performRequestAndParseEntity(request, IndexLifecycleRequestConverters::startSLM, options,
561+
AcknowledgedResponse::fromXContent, emptySet());
562+
}
563+
564+
/**
565+
* Asynchronously start the Snapshot Lifecycle Management feature.
566+
* See <pre>
567+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
568+
* java-rest-high-ilm-slm-start-slm.html
569+
* </pre> for more.
570+
* @param request the request
571+
* @param listener the listener to be notified upon request completion
572+
* @return cancellable that may be used to cancel the request
573+
*/
574+
public Cancellable startSLMAsync(StartSLMRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
575+
return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::startSLM, options,
576+
AcknowledgedResponse::fromXContent, listener, emptySet());
577+
}
578+
579+
/**
580+
* Stop the Snapshot Lifecycle Management feature.
581+
* See <pre>
582+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
583+
* java-rest-high-ilm-slm-stop-slm.html
584+
* </pre> for more.
585+
* @param request the request
586+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
587+
* @return the response
588+
* @throws IOException in case there is a problem sending the request or parsing back the response
589+
*/
590+
public AcknowledgedResponse stopSLM(StopSLMRequest request, RequestOptions options) throws IOException {
591+
return restHighLevelClient.performRequestAndParseEntity(request, IndexLifecycleRequestConverters::stopSLM, options,
592+
AcknowledgedResponse::fromXContent, emptySet());
593+
}
594+
595+
/**
596+
* Asynchronously stop the Snapshot Lifecycle Management feature.
597+
* See <pre>
598+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
599+
* java-rest-high-ilm-slm-stop-slm.html
600+
* </pre> for more.
601+
* @param request the request
602+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
603+
* @param listener the listener to be notified upon request completion
604+
* @return cancellable that may be used to cancel the request
605+
*/
606+
public Cancellable stopSLMAsync(StopSLMRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
607+
return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::stopSLM, options,
608+
AcknowledgedResponse::fromXContent, listener, emptySet());
609+
}
610+
611+
/**
612+
* Get the status of Snapshot Lifecycle Management.
613+
* See <pre>
614+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
615+
* java-rest-high-ilm-slm-status.html
616+
* </pre> for more.
617+
* @param request the request
618+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
619+
* @return the response
620+
* @throws IOException in case there is a problem sending the request or parsing back the response
621+
*/
622+
public LifecycleManagementStatusResponse getSLMStatus(SnapshotLifecycleManagementStatusRequest request,
623+
RequestOptions options) throws IOException {
624+
return restHighLevelClient.performRequestAndParseEntity(request, IndexLifecycleRequestConverters::snapshotLifecycleManagementStatus,
625+
options, LifecycleManagementStatusResponse::fromXContent, emptySet());
626+
}
627+
628+
/**
629+
* Asynchronously get the status of Snapshot Lifecycle Management.
630+
* See <pre>
631+
* https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/
632+
* java-rest-high-ilm-slm-status.html
633+
* </pre> for more.
634+
* @param request the request
635+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
636+
* @param listener the listener to be notified upon request completion
637+
* @return cancellable that may be used to cancel the request
638+
*/
639+
public Cancellable getSLMStatusAsync(SnapshotLifecycleManagementStatusRequest request, RequestOptions options,
640+
ActionListener<LifecycleManagementStatusResponse> listener) {
641+
return restHighLevelClient.performRequestAsyncAndParseEntity(request,
642+
IndexLifecycleRequestConverters::snapshotLifecycleManagementStatus, options, LifecycleManagementStatusResponse::fromXContent,
643+
listener, emptySet());
644+
}
544645
}

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import org.elasticsearch.client.slm.GetSnapshotLifecyclePolicyRequest;
3939
import org.elasticsearch.client.slm.GetSnapshotLifecycleStatsRequest;
4040
import org.elasticsearch.client.slm.PutSnapshotLifecyclePolicyRequest;
41+
import org.elasticsearch.client.slm.SnapshotLifecycleManagementStatusRequest;
42+
import org.elasticsearch.client.slm.StartSLMRequest;
43+
import org.elasticsearch.client.slm.StopSLMRequest;
4144
import org.elasticsearch.common.Strings;
4245

4346
import java.io.IOException;
@@ -239,4 +242,43 @@ static Request getSnapshotLifecycleStats(GetSnapshotLifecycleStatsRequest getSna
239242
request.addParameters(params.asMap());
240243
return request;
241244
}
245+
246+
static Request snapshotLifecycleManagementStatus(SnapshotLifecycleManagementStatusRequest snapshotLifecycleManagementStatusRequest){
247+
Request request = new Request(HttpGet.METHOD_NAME,
248+
new RequestConverters.EndpointBuilder()
249+
.addPathPartAsIs("_slm")
250+
.addPathPartAsIs("status")
251+
.build());
252+
RequestConverters.Params params = new RequestConverters.Params();
253+
params.withMasterTimeout(snapshotLifecycleManagementStatusRequest.masterNodeTimeout());
254+
params.withTimeout(snapshotLifecycleManagementStatusRequest.timeout());
255+
request.addParameters(params.asMap());
256+
return request;
257+
}
258+
259+
static Request startSLM(StartSLMRequest startSLMRequest) {
260+
Request request = new Request(HttpPost.METHOD_NAME,
261+
new RequestConverters.EndpointBuilder()
262+
.addPathPartAsIs("_slm")
263+
.addPathPartAsIs("start")
264+
.build());
265+
RequestConverters.Params params = new RequestConverters.Params();
266+
params.withMasterTimeout(startSLMRequest.masterNodeTimeout());
267+
params.withTimeout(startSLMRequest.timeout());
268+
request.addParameters(params.asMap());
269+
return request;
270+
}
271+
272+
static Request stopSLM(StopSLMRequest stopSLMRequest) {
273+
Request request = new Request(HttpPost.METHOD_NAME,
274+
new RequestConverters.EndpointBuilder()
275+
.addPathPartAsIs("_slm")
276+
.addPathPartAsIs("stop")
277+
.build());
278+
RequestConverters.Params params = new RequestConverters.Params();
279+
params.withMasterTimeout(stopSLMRequest.masterNodeTimeout());
280+
params.withTimeout(stopSLMRequest.timeout());
281+
request.addParameters(params.asMap());
282+
return request;
283+
}
242284
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.client.ccr;
21+
22+
import org.elasticsearch.client.Validatable;
23+
24+
import java.util.Objects;
25+
26+
/**
27+
* Request class for pause auto follow pattern api.
28+
*/
29+
public final class PauseAutoFollowPatternRequest implements Validatable {
30+
31+
private final String name;
32+
33+
/**
34+
* Pause auto follow pattern with the specified name
35+
*
36+
* @param name The name of the auto follow pattern to pause
37+
*/
38+
public PauseAutoFollowPatternRequest(String name) {
39+
this.name = Objects.requireNonNull(name);
40+
}
41+
42+
public String getName() {
43+
return name;
44+
}
45+
}

0 commit comments

Comments
 (0)