Skip to content

Commit 5848d9a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ack-watch
2 parents c4c52ff + d3a4fe9 commit 5848d9a

File tree

1,160 files changed

+25879
-11719
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,160 files changed

+25879
-11719
lines changed

TESTING.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ These are the linux flavors supported, all of which we provide images for
402402

403403
* ubuntu-1404 aka trusty
404404
* ubuntu-1604 aka xenial
405+
* ubuntu-1804 aka bionic beaver
405406
* debian-8 aka jessie
406407
* debian-9 aka stretch, the current debian stable distribution
407408
* centos-6

Vagrantfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ Vagrant.configure(2) do |config|
6161
SHELL
6262
end
6363
end
64+
'ubuntu-1804'.tap do |box|
65+
config.vm.define box, define_opts do |config|
66+
config.vm.box = 'elastic/ubuntu-18.04-x86_64'
67+
deb_common config, box, extra: <<-SHELL
68+
# Install Jayatana so we can work around it being present.
69+
[ -f /usr/share/java/jayatanaag.jar ] || install jayatana
70+
SHELL
71+
end
72+
end
6473
# Wheezy's backports don't contain Openjdk 8 and the backflips
6574
# required to get the sun jdk on there just aren't worth it. We have
6675
# jessie and stretch for testing debian and it works fine.

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantTestPlugin.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class VagrantTestPlugin implements Plugin<Project> {
3131
'opensuse-42',
3232
'sles-12',
3333
'ubuntu-1404',
34-
'ubuntu-1604'
34+
'ubuntu-1604',
35+
'ubuntu-1804'
3536
])
3637

3738
/** All Windows boxes that we test, which may or may not be supplied **/

buildSrc/src/main/resources/checkstyle.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,25 @@
1212

1313
<!-- Checks Java files and forbids empty Javadoc comments -->
1414
<module name="RegexpMultiline">
15+
<property name="id" value="EmptyJavadoc"/>
1516
<property name="format" value="\/\*[\s\*]*\*\/"/>
1617
<property name="fileExtensions" value="java"/>
1718
<property name="message" value="Empty javadoc comments are forbidden"/>
1819
</module>
1920

21+
<!--
22+
We include snippets that are wrapped in `// tag` and `// end` into the
23+
docs, stripping the leading spaces. If the context is wider than 76
24+
characters then it'll need to scroll. This fails the build if it sees
25+
such snippets.
26+
-->
27+
<module name="RegexpMultiline">
28+
<property name="id" value="SnippetLength"/>
29+
<property name="format" value="^( *)\/\/\s*tag(.+)\s*\n(.*\n)*\1.{77,}\n(.*\n)*\1\/\/\s*end\2\s*$"/>
30+
<property name="fileExtensions" value="java"/>
31+
<property name="message" value="Code snippets longer than 76 characters get cut off when rendered in the docs"/>
32+
</module>
33+
2034
<module name="TreeWalker">
2135
<!-- Its our official line length! See checkstyle_suppressions.xml for the files that don't pass this. For now we
2236
suppress the check there but enforce it everywhere else. This prevents the list from getting longer even if it is

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@
2121
configuration of classes that aren't in packages. -->
2222
<suppress files="test[/\\]framework[/\\]src[/\\]test[/\\]java[/\\]Dummy.java" checks="PackageDeclaration" />
2323

24+
<!--
25+
Truly temporary suppressions suppression of snippets included in
26+
documentation that are so wide that they scroll.
27+
-->
28+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]CRUDDocumentationIT.java" id="SnippetLength" />
29+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]ClusterClientDocumentationIT.java" id="SnippetLength" />
30+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]GraphDocumentationIT.java" id="SnippetLength" />
31+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]IndicesClientDocumentationIT.java" id="SnippetLength" />
32+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]IngestClientDocumentationIT.java" id="SnippetLength" />
33+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]LicensingDocumentationIT.java" id="SnippetLength" />
34+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]MigrationDocumentationIT.java" id="SnippetLength" />
35+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]MigrationClientDocumentationIT.java" id="SnippetLength" />
36+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]MiscellaneousDocumentationIT.java" id="SnippetLength" />
37+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]MlClientDocumentationIT.java" id="SnippetLength" />
38+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]RollupDocumentationIT.java" id="SnippetLength" />
39+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]SearchDocumentationIT.java" id="SnippetLength" />
40+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]SecurityDocumentationIT.java" id="SnippetLength" />
41+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]SnapshotClientDocumentationIT.java" id="SnippetLength" />
42+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]StoredScriptsDocumentationIT.java" id="SnippetLength" />
43+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]TasksClientDocumentationIT.java" id="SnippetLength" />
44+
<suppress files="client[/\\]rest-high-level[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]WatcherDocumentationIT.java" id="SnippetLength" />
45+
<suppress files="modules[/\\]reindex[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]documentation[/\\]ReindexDocumentationIT.jav" id="SnippetLength" />
46+
2447
<!-- Hopefully temporary suppression of LineLength on files that don't pass it. We should remove these when we the
2548
files start to pass. -->
2649
<suppress files="client[/\\]rest[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]HeapBufferedAsyncResponseConsumerTests.java" checks="LineLength" />
@@ -138,7 +161,6 @@
138161
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]AcknowledgedRequestBuilder.java" checks="LineLength" />
139162
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]MasterNodeOperationRequestBuilder.java" checks="LineLength" />
140163
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]MasterNodeReadOperationRequestBuilder.java" checks="LineLength" />
141-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]TransportMasterNodeAction.java" checks="LineLength" />
142164
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]info[/\\]ClusterInfoRequest.java" checks="LineLength" />
143165
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]info[/\\]ClusterInfoRequestBuilder.java" checks="LineLength" />
144166
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]master[/\\]info[/\\]TransportClusterInfoAction.java" checks="LineLength" />

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
package org.elasticsearch.client.benchmark.ops.bulk;
2020

2121
import org.apache.logging.log4j.Logger;
22+
import org.apache.logging.log4j.LogManager;
2223
import org.elasticsearch.ElasticsearchException;
2324
import org.elasticsearch.client.benchmark.BenchmarkTask;
2425
import org.elasticsearch.client.benchmark.metrics.Sample;
2526
import org.elasticsearch.client.benchmark.metrics.SampleRecorder;
2627
import org.elasticsearch.common.SuppressForbidden;
2728
import org.elasticsearch.common.io.PathUtils;
28-
import org.elasticsearch.common.logging.ESLoggerFactory;
2929

3030
import java.io.BufferedReader;
3131
import java.io.IOException;
@@ -135,7 +135,7 @@ private void sendBulk(List<String> bulkData) throws InterruptedException {
135135

136136

137137
private static final class BulkIndexer implements Runnable {
138-
private static final Logger logger = ESLoggerFactory.getLogger(BulkIndexer.class.getName());
138+
private static final Logger logger = LogManager.getLogger(BulkIndexer.class);
139139

140140
private final BlockingQueue<List<String>> bulkData;
141141
private final int warmupIterations;

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,9 @@ public final BulkByScrollResponse updateByQuery(UpdateByQueryRequest updateByQue
480480
* @param listener the listener to be notified upon request completion
481481
*/
482482
public final void updateByQueryAsync(UpdateByQueryRequest updateByQueryRequest, RequestOptions options,
483-
ActionListener<BulkByScrollResponse> listener) {
483+
ActionListener<BulkByScrollResponse> listener) {
484484
performRequestAsyncAndParseEntity(
485-
updateByQueryRequest, RequestConverters::updateByQuery, options, BulkByScrollResponse::fromXContent, listener, emptySet()
485+
updateByQueryRequest, RequestConverters::updateByQuery, options, BulkByScrollResponse::fromXContent, listener, emptySet()
486486
);
487487
}
488488

@@ -512,36 +512,38 @@ public final BulkByScrollResponse deleteByQuery(DeleteByQueryRequest deleteByQue
512512
public final void deleteByQueryAsync(DeleteByQueryRequest deleteByQueryRequest, RequestOptions options,
513513
ActionListener<BulkByScrollResponse> listener) {
514514
performRequestAsyncAndParseEntity(
515-
deleteByQueryRequest, RequestConverters::deleteByQuery, options, BulkByScrollResponse::fromXContent, listener, emptySet()
515+
deleteByQueryRequest, RequestConverters::deleteByQuery, options, BulkByScrollResponse::fromXContent, listener, emptySet()
516516
);
517517
}
518518

519519
/**
520520
* Executes a reindex rethrottling request.
521521
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-rethrottle">
522-
* Reindex rethrottling API on elastic.co</a>
522+
* Reindex rethrottling API on elastic.co</a>
523+
*
523524
* @param rethrottleRequest the request
524-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
525+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
525526
* @return the response
526527
* @throws IOException in case there is a problem sending the request or parsing back the response
527528
*/
528529
public final ListTasksResponse reindexRethrottle(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException {
529530
return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottle, options, ListTasksResponse::fromXContent,
530-
emptySet());
531+
emptySet());
531532
}
532533

533534
/**
534535
* Executes a reindex rethrottling request.
535536
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-rethrottle">
536-
* Reindex rethrottling API on elastic.co</a>
537+
* Reindex rethrottling API on elastic.co</a>
538+
*
537539
* @param rethrottleRequest the request
538-
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
539-
* @param listener the listener to be notified upon request completion
540+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
541+
* @param listener the listener to be notified upon request completion
540542
*/
541543
public final void reindexRethrottleAsync(RethrottleRequest rethrottleRequest, RequestOptions options,
542-
ActionListener<ListTasksResponse> listener) {
544+
ActionListener<ListTasksResponse> listener) {
543545
performRequestAsyncAndParseEntity(rethrottleRequest, RequestConverters::rethrottle, options, ListTasksResponse::fromXContent,
544-
listener, emptySet());
546+
listener, emptySet());
545547
}
546548

547549
/**

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
package org.elasticsearch.client;
2121

2222
import org.elasticsearch.action.ActionListener;
23+
import org.elasticsearch.client.rollup.GetRollupJobRequest;
24+
import org.elasticsearch.client.rollup.GetRollupJobResponse;
2325
import org.elasticsearch.client.rollup.PutRollupJobRequest;
2426
import org.elasticsearch.client.rollup.PutRollupJobResponse;
2527

@@ -73,4 +75,37 @@ public void putRollupJobAsync(PutRollupJobRequest request, RequestOptions option
7375
PutRollupJobResponse::fromXContent,
7476
listener, Collections.emptySet());
7577
}
78+
79+
/**
80+
* Get a rollup job from the cluster.
81+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-put-job.html">
82+
* the docs</a> for more.
83+
* @param request the request
84+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
85+
* @return the response
86+
* @throws IOException in case there is a problem sending the request or parsing back the response
87+
*/
88+
public GetRollupJobResponse getRollupJob(GetRollupJobRequest request, RequestOptions options) throws IOException {
89+
return restHighLevelClient.performRequestAndParseEntity(request,
90+
RollupRequestConverters::getJob,
91+
options,
92+
GetRollupJobResponse::fromXContent,
93+
Collections.emptySet());
94+
}
95+
96+
/**
97+
* Asynchronously get a rollup job from the cluster.
98+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-put-job.html">
99+
* the docs</a> for more.
100+
* @param request the request
101+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
102+
* @param listener the listener to be notified upon request completion
103+
*/
104+
public void getRollupJobAsync(GetRollupJobRequest request, RequestOptions options, ActionListener<GetRollupJobResponse> listener) {
105+
restHighLevelClient.performRequestAsyncAndParseEntity(request,
106+
RollupRequestConverters::getJob,
107+
options,
108+
GetRollupJobResponse::fromXContent,
109+
listener, Collections.emptySet());
110+
}
76111
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
*/
1919
package org.elasticsearch.client;
2020

21+
import org.apache.http.client.methods.HttpGet;
2122
import org.apache.http.client.methods.HttpPut;
23+
import org.elasticsearch.client.rollup.GetRollupJobRequest;
2224
import org.elasticsearch.client.rollup.PutRollupJobRequest;
2325

2426
import java.io.IOException;
@@ -42,4 +44,14 @@ static Request putJob(final PutRollupJobRequest putRollupJobRequest) throws IOEx
4244
request.setEntity(createEntity(putRollupJobRequest, REQUEST_BODY_CONTENT_TYPE));
4345
return request;
4446
}
47+
48+
static Request getJob(final GetRollupJobRequest getRollupJobRequest) {
49+
String endpoint = new RequestConverters.EndpointBuilder()
50+
.addPathPartAsIs("_xpack")
51+
.addPathPartAsIs("rollup")
52+
.addPathPartAsIs("job")
53+
.addPathPart(getRollupJobRequest.getJobId())
54+
.build();
55+
return new Request(HttpGet.METHOD_NAME, endpoint);
56+
}
4557
}

0 commit comments

Comments
 (0)