Skip to content

Commit 46efbd7

Browse files
committed
Merge remote-tracking branch 'elastic/master' into improve-content-type-detection-with-leading-whitespace
* elastic/master: (34 commits) Cross-cluster search: preserve cluster alias in shard failures (elastic#32608) Handle AlreadyClosedException when bumping primary term [TEST] Allow to run in FIPS JVM (elastic#32607) [Test] Add ckb to the list of unsupported languages (elastic#32611) SCRIPTING: Move Aggregation Scripts to their own context (elastic#32068) Painless: Use LocalMethod Map For Lookup at Runtime (elastic#32599) [TEST] Enhance failure message when bulk updates have failures [ML] Add ML result classes to protocol library (elastic#32587) Suppress LicensingDocumentationIT.testPutLicense in release builds (elastic#32613) [Rollup] Update wire version check after backport Suppress Wildfly test in FIPS JVMs (elastic#32543) [Rollup] Improve ID scheme for rollup documents (elastic#32558) ingest: doc: move Dot Expander Processor doc to correct position (elastic#31743) [ML] Add some ML config classes to protocol library (elastic#32502) [TEST]Split transport verification mode none tests (elastic#32488) Core: Move helper date formatters over to java time (elastic#32504) [Rollup] Remove builders from DateHistogramGroupConfig (elastic#32555) [TEST} unmutes SearchAsyncActionTests and adds debugging info [ML] Add Detector config classes to protocol library (elastic#32495) [Rollup] Remove builders from MetricConfig (elastic#32536) ...
2 parents 53b1770 + 826399f commit 46efbd7

File tree

328 files changed

+9914
-2095
lines changed

Some content is hidden

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

328 files changed

+9914
-2095
lines changed

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

+28-6
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ public class RestHighLevelClient implements Closeable {
205205
private final SnapshotClient snapshotClient = new SnapshotClient(this);
206206
private final TasksClient tasksClient = new TasksClient(this);
207207
private final XPackClient xPackClient = new XPackClient(this);
208+
private final WatcherClient watcherClient = new WatcherClient(this);
209+
private final LicenseClient licenseClient = new LicenseClient(this);
208210

209211
/**
210212
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -296,18 +298,38 @@ public final TasksClient tasks() {
296298
}
297299

298300
/**
299-
* A wrapper for the {@link RestHighLevelClient} that provides methods for
300-
* accessing the Elastic Licensed X-Pack APIs that are shipped with the
301-
* default distribution of Elasticsearch. All of these APIs will 404 if run
302-
* against the OSS distribution of Elasticsearch.
301+
* Provides methods for accessing the Elastic Licensed X-Pack Info
302+
* and Usage APIs that are shipped with the default distribution of
303+
* Elasticsearch. All of these APIs will 404 if run against the OSS
304+
* distribution of Elasticsearch.
303305
* <p>
304-
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-api.html">
305-
* X-Pack APIs on elastic.co</a> for more information.
306+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html">
307+
* Info APIs on elastic.co</a> for more information.
306308
*/
307309
public final XPackClient xpack() {
308310
return xPackClient;
309311
}
310312

313+
/**
314+
* Provides methods for accessing the Elastic Licensed Watcher APIs that
315+
* are shipped with the default distribution of Elasticsearch. All of
316+
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
317+
* <p>
318+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html">
319+
* Watcher APIs on elastic.co</a> for more information.
320+
*/
321+
public WatcherClient watcher() { return watcherClient; }
322+
323+
/**
324+
* Provides methods for accessing the Elastic Licensed Licensing APIs that
325+
* are shipped with the default distribution of Elasticsearch. All of
326+
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
327+
* <p>
328+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/licensing-apis.html">
329+
* Licensing APIs on elastic.co</a> for more information.
330+
*/
331+
public LicenseClient license() { return licenseClient; }
332+
311333
/**
312334
* Executes a bulk request using the Bulk API.
313335
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>

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

-19
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,9 @@
4141
public final class XPackClient {
4242

4343
private final RestHighLevelClient restHighLevelClient;
44-
private final WatcherClient watcherClient;
45-
private final LicenseClient licenseClient;
4644

4745
XPackClient(RestHighLevelClient restHighLevelClient) {
4846
this.restHighLevelClient = restHighLevelClient;
49-
this.watcherClient = new WatcherClient(restHighLevelClient);
50-
this.licenseClient = new LicenseClient(restHighLevelClient);
51-
}
52-
53-
public WatcherClient watcher() {
54-
return watcherClient;
5547
}
5648

5749
/**
@@ -102,15 +94,4 @@ public void usageAsync(XPackUsageRequest request, RequestOptions options, Action
10294
restHighLevelClient.performRequestAsyncAndParseEntity(request, RequestConverters::xpackUsage, options,
10395
XPackUsageResponse::fromXContent, listener, emptySet());
10496
}
105-
106-
/**
107-
* A wrapper for the {@link RestHighLevelClient} that provides methods for
108-
* accessing the Elastic Licensing APIs.
109-
* <p>
110-
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/licensing-apis.html">
111-
* X-Pack APIs on elastic.co</a> for more information.
112-
*/
113-
public LicenseClient license() {
114-
return licenseClient;
115-
}
11697
}

client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ public void testApiNamingConventions() throws Exception {
755755
method.isAnnotationPresent(Deprecated.class));
756756
} else {
757757
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
758-
if (apiName.startsWith("xpack.") == false) {
758+
if (apiName.startsWith("xpack.") == false &&
759+
apiName.startsWith("license.") == false &&
760+
apiName.startsWith("watcher.") == false) {
759761
apiNotFound.add(apiName);
760762
}
761763
}

client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherIT.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ private PutWatchResponse createWatch(String watchId) throws Exception {
4646
"}";
4747
BytesReference bytesReference = new BytesArray(json);
4848
PutWatchRequest putWatchRequest = new PutWatchRequest(watchId, bytesReference, XContentType.JSON);
49-
return highLevelClient().xpack().watcher().putWatch(putWatchRequest, RequestOptions.DEFAULT);
49+
return highLevelClient().watcher().putWatch(putWatchRequest, RequestOptions.DEFAULT);
5050
}
5151

5252
public void testDeleteWatch() throws Exception {
5353
// delete watch that exists
5454
{
5555
String watchId = randomAlphaOfLength(10);
5656
createWatch(watchId);
57-
DeleteWatchResponse deleteWatchResponse = highLevelClient().xpack().watcher().deleteWatch(new DeleteWatchRequest(watchId),
57+
DeleteWatchResponse deleteWatchResponse = highLevelClient().watcher().deleteWatch(new DeleteWatchRequest(watchId),
5858
RequestOptions.DEFAULT);
5959
assertThat(deleteWatchResponse.getId(), is(watchId));
6060
assertThat(deleteWatchResponse.getVersion(), is(2L));
@@ -64,7 +64,7 @@ public void testDeleteWatch() throws Exception {
6464
// delete watch that does not exist
6565
{
6666
String watchId = randomAlphaOfLength(10);
67-
DeleteWatchResponse deleteWatchResponse = highLevelClient().xpack().watcher().deleteWatch(new DeleteWatchRequest(watchId),
67+
DeleteWatchResponse deleteWatchResponse = highLevelClient().watcher().deleteWatch(new DeleteWatchRequest(watchId),
6868
RequestOptions.DEFAULT);
6969
assertThat(deleteWatchResponse.getId(), is(watchId));
7070
assertThat(deleteWatchResponse.getVersion(), is(1L));

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/LicensingDocumentationIT.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
package org.elasticsearch.client.documentation;
2121

22-
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
22+
import org.elasticsearch.Build;
2323
import org.elasticsearch.action.ActionListener;
2424
import org.elasticsearch.action.LatchedActionListener;
2525
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
@@ -41,10 +41,10 @@
4141
* Documentation for Licensing APIs in the high level java client.
4242
* Code wrapped in {@code tag} and {@code end} tags is included in the docs.
4343
*/
44-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32580")
4544
public class LicensingDocumentationIT extends ESRestHighLevelClientTestCase {
4645

4746
public void testPutLicense() throws Exception {
47+
assumeTrue("License is only valid when tested against snapshot/test builds", Build.CURRENT.isSnapshot());
4848
RestHighLevelClient client = highLevelClient();
4949
String license = "{\"license\": {\"uid\":\"893361dc-9749-4997-93cb-802e3d7fa4a8\",\"type\":\"gold\"," +
5050
"\"issue_date_in_millis\":1411948800000,\"expiry_date_in_millis\":1914278399999,\"max_nodes\":1,\"issued_to\":\"issued_to\"," +
@@ -62,7 +62,7 @@ public void testPutLicense() throws Exception {
6262
request.setLicenseDefinition(license); // <1>
6363
request.setAcknowledge(false); // <2>
6464

65-
PutLicenseResponse response = client.xpack().license().putLicense(request, RequestOptions.DEFAULT);
65+
PutLicenseResponse response = client.license().putLicense(request, RequestOptions.DEFAULT);
6666
//end::put-license-execute
6767

6868
//tag::put-license-response
@@ -98,7 +98,7 @@ public void onFailure(Exception e) {
9898
listener = new LatchedActionListener<>(listener, latch);
9999

100100
// tag::put-license-execute-async
101-
client.xpack().license().putLicenseAsync(
101+
client.license().putLicenseAsync(
102102
request, RequestOptions.DEFAULT, listener); // <1>
103103
// end::put-license-execute-async
104104

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/WatcherDocumentationIT.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testWatcher() throws Exception {
4949
"}");
5050
PutWatchRequest request = new PutWatchRequest("my_watch_id", watch, XContentType.JSON);
5151
request.setActive(false); // <1>
52-
PutWatchResponse response = client.xpack().watcher().putWatch(request, RequestOptions.DEFAULT);
52+
PutWatchResponse response = client.watcher().putWatch(request, RequestOptions.DEFAULT);
5353
//end::x-pack-put-watch-execute
5454

5555
//tag::x-pack-put-watch-response
@@ -85,7 +85,7 @@ public void onFailure(Exception e) {
8585
listener = new LatchedActionListener<>(listener, latch);
8686

8787
// tag::x-pack-put-watch-execute-async
88-
client.xpack().watcher().putWatchAsync(request, RequestOptions.DEFAULT, listener); // <1>
88+
client.watcher().putWatchAsync(request, RequestOptions.DEFAULT, listener); // <1>
8989
// end::x-pack-put-watch-execute-async
9090

9191
assertTrue(latch.await(30L, TimeUnit.SECONDS));
@@ -94,7 +94,7 @@ public void onFailure(Exception e) {
9494
{
9595
//tag::x-pack-delete-watch-execute
9696
DeleteWatchRequest request = new DeleteWatchRequest("my_watch_id");
97-
DeleteWatchResponse response = client.xpack().watcher().deleteWatch(request, RequestOptions.DEFAULT);
97+
DeleteWatchResponse response = client.watcher().deleteWatch(request, RequestOptions.DEFAULT);
9898
//end::x-pack-delete-watch-execute
9999

100100
//tag::x-pack-delete-watch-response
@@ -125,7 +125,7 @@ public void onFailure(Exception e) {
125125
listener = new LatchedActionListener<>(listener, latch);
126126

127127
// tag::x-pack-delete-watch-execute-async
128-
client.xpack().watcher().deleteWatchAsync(request, RequestOptions.DEFAULT, listener); // <1>
128+
client.watcher().deleteWatchAsync(request, RequestOptions.DEFAULT, listener); // <1>
129129
// end::x-pack-delete-watch-execute-async
130130

131131
assertTrue(latch.await(30L, TimeUnit.SECONDS));

docs/reference/analysis/charfilters/pattern-replace-charfilter.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The above example produces the following term:
8787

8888
[source,text]
8989
---------------------------
90-
[ My, credit, card, is 123_456_789 ]
90+
[ My, credit, card, is, 123_456_789 ]
9191
---------------------------
9292

9393
WARNING: Using a replacement string that changes the length of the original

docs/reference/cluster/stats.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Will return, for example:
2222
"successful" : 1,
2323
"failed" : 0
2424
},
25+
"cluster_uuid": "YjAvIhsCQ9CbjWZb2qJw3Q",
2526
"cluster_name": "elasticsearch",
2627
"timestamp": 1459427693515,
2728
"status": "green",

0 commit comments

Comments
 (0)