Skip to content

Commit a55f614

Browse files
committed
Merge branch 'master' into ccr
* master: ingest: Add ignore_missing property to foreach filter (#22147) (#31578) Fix a formatting issue in the docvalue_fields documentation. (#31563) reduce log level at gradle configuration time [TEST] Close additional clients created while running yaml tests (#31575) Docs: Clarify sensitive fields watcher encryption (#31551) Watcher: Remove never executed code (#31135) Add support for switching distribution for all integration tests (#30874) Improve robustness of geo shape parser for malformed shapes (#31449) QA: Create xpack yaml features (#31403) Improve test times for tests using `RandomObjects::addFields` (#31556) [Test] Add full cluster restart test for Rollup (#31533) Enhance thread context uniqueness assertion [DOCS] Fix heading format errors (#31483) fix writeIndex evaluation for aliases (#31562) Add x-opaque-id to search slow logs (#31539) Watcher: Fix put watch action (#31524) Add package pre-install check for java binary (#31343) Reduce number of raw types warnings (#31523) Migrate scripted metric aggregation scripts to ScriptContext design (#30111) turn GetFieldMappingsResponse to ToXContentObject (#31544) Close xcontent parsers (partial) (#31513) Ingest Attachment: Upgrade Tika to 1.18 (#31252) TEST: Correct the assertion arguments order (#31540)
2 parents 3cd8392 + 13e1cf6 commit a55f614

File tree

232 files changed

+2920
-1697
lines changed

Some content is hidden

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

232 files changed

+2920
-1697
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy

+4-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public class PluginBuildPlugin extends BuildPlugin {
7171
if (isModule) {
7272
project.integTestCluster.module(project)
7373
project.tasks.run.clusterConfig.module(project)
74-
project.tasks.run.clusterConfig.distribution = 'integ-test-zip'
74+
project.tasks.run.clusterConfig.distribution = System.getProperty(
75+
'run.distribution', 'integ-test-zip'
76+
)
7577
} else {
7678
project.integTestCluster.plugin(project.path)
7779
project.tasks.run.clusterConfig.plugin(project.path)
@@ -111,7 +113,7 @@ public class PluginBuildPlugin extends BuildPlugin {
111113
private static void createIntegTestTask(Project project) {
112114
RestIntegTestTask integTest = project.tasks.create('integTest', RestIntegTestTask.class)
113115
integTest.mustRunAfter(project.precommit, project.test)
114-
project.integTestCluster.distribution = 'integ-test-zip'
116+
project.integTestCluster.distribution = System.getProperty('tests.distribution', 'integ-test-zip')
115117
project.check.dependsOn(integTest)
116118
}
117119

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy

+8-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class ClusterFormationTasks {
8888
Configuration currentDistro = project.configurations.create("${prefix}_elasticsearchDistro")
8989
Configuration bwcDistro = project.configurations.create("${prefix}_elasticsearchBwcDistro")
9090
Configuration bwcPlugins = project.configurations.create("${prefix}_elasticsearchBwcPlugins")
91+
if (System.getProperty('tests.distribution', 'oss-zip') == 'integ-test-zip') {
92+
throw new Exception("tests.distribution=integ-test-zip is not supported")
93+
}
9194
configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearch)
9295
if (config.numBwcNodes > 0) {
9396
if (config.bwcVersion == null) {
@@ -533,7 +536,8 @@ class ClusterFormationTasks {
533536

534537
static Task configureInstallModuleTask(String name, Project project, Task setup, NodeInfo node, Project module) {
535538
if (node.config.distribution != 'integ-test-zip') {
536-
throw new GradleException("Module ${module.path} not allowed be installed distributions other than integ-test-zip because they should already have all modules bundled!")
539+
project.logger.info("Not installing modules for $name, ${node.config.distribution} already has them")
540+
return setup
537541
}
538542
if (module.plugins.hasPlugin(PluginBuildPlugin) == false) {
539543
throw new GradleException("Task ${name} cannot include module ${module.path} which is not an esplugin")
@@ -643,6 +647,9 @@ class ClusterFormationTasks {
643647
BuildPlugin.requireJavaHome(start, node.javaVersion)
644648
}
645649
start.doLast(elasticsearchRunner)
650+
start.doFirst {
651+
project.logger.info("Starting node in ${node.clusterName} distribution: ${node.config.distribution}")
652+
}
646653
return start
647654
}
648655

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public NoopSearchRequestBuilder addSort(String field, SortOrder order) {
329329
*
330330
* @see org.elasticsearch.search.sort.SortBuilders
331331
*/
332-
public NoopSearchRequestBuilder addSort(SortBuilder sort) {
332+
public NoopSearchRequestBuilder addSort(SortBuilder<?> sort) {
333333
sourceBuilder().sort(sort);
334334
return this;
335335
}
@@ -415,7 +415,7 @@ public NoopSearchRequestBuilder setRescorer(RescorerBuilder<?> rescorer) {
415415
* @param window rescore window
416416
* @return this for chaining
417417
*/
418-
public NoopSearchRequestBuilder setRescorer(RescorerBuilder rescorer, int window) {
418+
public NoopSearchRequestBuilder setRescorer(RescorerBuilder<?> rescorer, int window) {
419419
sourceBuilder().clearRescorers();
420420
return addRescorer(rescorer.windowSize(window));
421421
}

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

+22-22
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testIndex() throws Exception {
113113
.source(jsonMap); // <1>
114114
//end::index-request-map
115115
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
116-
assertEquals(indexResponse.getResult(), DocWriteResponse.Result.CREATED);
116+
assertEquals(DocWriteResponse.Result.CREATED, indexResponse.getResult());
117117
}
118118
{
119119
//tag::index-request-xcontent
@@ -129,7 +129,7 @@ public void testIndex() throws Exception {
129129
.source(builder); // <1>
130130
//end::index-request-xcontent
131131
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
132-
assertEquals(indexResponse.getResult(), DocWriteResponse.Result.UPDATED);
132+
assertEquals(DocWriteResponse.Result.UPDATED, indexResponse.getResult());
133133
}
134134
{
135135
//tag::index-request-shortcut
@@ -139,7 +139,7 @@ public void testIndex() throws Exception {
139139
"message", "trying out Elasticsearch"); // <1>
140140
//end::index-request-shortcut
141141
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
142-
assertEquals(indexResponse.getResult(), DocWriteResponse.Result.UPDATED);
142+
assertEquals(DocWriteResponse.Result.UPDATED, indexResponse.getResult());
143143
}
144144
{
145145
//tag::index-request-string
@@ -158,7 +158,7 @@ public void testIndex() throws Exception {
158158
// tag::index-execute
159159
IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT);
160160
// end::index-execute
161-
assertEquals(indexResponse.getResult(), DocWriteResponse.Result.UPDATED);
161+
assertEquals(DocWriteResponse.Result.UPDATED, indexResponse.getResult());
162162

163163
// tag::index-response
164164
String index = indexResponse.getIndex();
@@ -269,7 +269,7 @@ public void testUpdate() throws Exception {
269269
{
270270
IndexRequest indexRequest = new IndexRequest("posts", "doc", "1").source("field", 0);
271271
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
272-
assertSame(indexResponse.status(), RestStatus.CREATED);
272+
assertSame(RestStatus.CREATED, indexResponse.status());
273273

274274
Request request = new Request("POST", "/_scripts/increment-field");
275275
request.setJsonEntity(Strings.toString(JsonXContent.contentBuilder()
@@ -280,7 +280,7 @@ public void testUpdate() throws Exception {
280280
.endObject()
281281
.endObject()));
282282
Response response = client().performRequest(request);
283-
assertEquals(response.getStatusLine().getStatusCode(), RestStatus.OK.getStatus());
283+
assertEquals(RestStatus.OK.getStatus(), response.getStatusLine().getStatusCode());
284284
}
285285
{
286286
//tag::update-request
@@ -298,7 +298,7 @@ public void testUpdate() throws Exception {
298298
request.script(inline); // <3>
299299
//end::update-request-with-inline-script
300300
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
301-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
301+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
302302
assertEquals(4, updateResponse.getGetResult().getSource().get("field"));
303303

304304
request = new UpdateRequest("posts", "doc", "1").fetchSource(true);
@@ -308,7 +308,7 @@ public void testUpdate() throws Exception {
308308
request.script(stored); // <2>
309309
//end::update-request-with-stored-script
310310
updateResponse = client.update(request, RequestOptions.DEFAULT);
311-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
311+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
312312
assertEquals(8, updateResponse.getGetResult().getSource().get("field"));
313313
}
314314
{
@@ -320,7 +320,7 @@ public void testUpdate() throws Exception {
320320
.doc(jsonMap); // <1>
321321
//end::update-request-with-doc-as-map
322322
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
323-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
323+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
324324
}
325325
{
326326
//tag::update-request-with-doc-as-xcontent
@@ -335,7 +335,7 @@ public void testUpdate() throws Exception {
335335
.doc(builder); // <1>
336336
//end::update-request-with-doc-as-xcontent
337337
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
338-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
338+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
339339
}
340340
{
341341
//tag::update-request-shortcut
@@ -344,7 +344,7 @@ public void testUpdate() throws Exception {
344344
"reason", "daily update"); // <1>
345345
//end::update-request-shortcut
346346
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
347-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
347+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
348348
}
349349
{
350350
//tag::update-request-with-doc-as-string
@@ -359,7 +359,7 @@ public void testUpdate() throws Exception {
359359
// tag::update-execute
360360
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
361361
// end::update-execute
362-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
362+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
363363

364364
// tag::update-response
365365
String index = updateResponse.getIndex();
@@ -434,7 +434,7 @@ public void testUpdate() throws Exception {
434434
request.fetchSource(true); // <1>
435435
//end::update-request-no-source
436436
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
437-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
437+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
438438
assertNotNull(updateResponse.getGetResult());
439439
assertEquals(3, updateResponse.getGetResult().sourceAsMap().size());
440440
}
@@ -446,7 +446,7 @@ public void testUpdate() throws Exception {
446446
request.fetchSource(new FetchSourceContext(true, includes, excludes)); // <1>
447447
//end::update-request-source-include
448448
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
449-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
449+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
450450
Map<String, Object> sourceAsMap = updateResponse.getGetResult().sourceAsMap();
451451
assertEquals(2, sourceAsMap.size());
452452
assertEquals("source includes", sourceAsMap.get("reason"));
@@ -460,7 +460,7 @@ public void testUpdate() throws Exception {
460460
request.fetchSource(new FetchSourceContext(true, includes, excludes)); // <1>
461461
//end::update-request-source-exclude
462462
UpdateResponse updateResponse = client.update(request, RequestOptions.DEFAULT);
463-
assertEquals(updateResponse.getResult(), DocWriteResponse.Result.UPDATED);
463+
assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());
464464
Map<String, Object> sourceAsMap = updateResponse.getGetResult().sourceAsMap();
465465
assertEquals(2, sourceAsMap.size());
466466
assertEquals("source excludes", sourceAsMap.get("reason"));
@@ -538,7 +538,7 @@ public void testDelete() throws Exception {
538538
{
539539
IndexRequest indexRequest = new IndexRequest("posts", "doc", "1").source("field", "value");
540540
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
541-
assertSame(indexResponse.status(), RestStatus.CREATED);
541+
assertSame(RestStatus.CREATED, indexResponse.status());
542542
}
543543

544544
{
@@ -552,7 +552,7 @@ public void testDelete() throws Exception {
552552
// tag::delete-execute
553553
DeleteResponse deleteResponse = client.delete(request, RequestOptions.DEFAULT);
554554
// end::delete-execute
555-
assertSame(deleteResponse.getResult(), DocWriteResponse.Result.DELETED);
555+
assertSame(DocWriteResponse.Result.DELETED, deleteResponse.getResult());
556556

557557
// tag::delete-response
558558
String index = deleteResponse.getIndex();
@@ -605,7 +605,7 @@ public void testDelete() throws Exception {
605605
{
606606
IndexResponse indexResponse = client.index(new IndexRequest("posts", "doc", "1").source("field", "value")
607607
, RequestOptions.DEFAULT);
608-
assertSame(indexResponse.status(), RestStatus.CREATED);
608+
assertSame(RestStatus.CREATED, indexResponse.status());
609609

610610
// tag::delete-conflict
611611
try {
@@ -621,7 +621,7 @@ public void testDelete() throws Exception {
621621
{
622622
IndexResponse indexResponse = client.index(new IndexRequest("posts", "doc", "async").source("field", "value"),
623623
RequestOptions.DEFAULT);
624-
assertSame(indexResponse.status(), RestStatus.CREATED);
624+
assertSame(RestStatus.CREATED, indexResponse.status());
625625

626626
DeleteRequest request = new DeleteRequest("posts", "doc", "async");
627627

@@ -666,7 +666,7 @@ public void testBulk() throws Exception {
666666
// tag::bulk-execute
667667
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
668668
// end::bulk-execute
669-
assertSame(bulkResponse.status(), RestStatus.OK);
669+
assertSame(RestStatus.OK, bulkResponse.status());
670670
assertFalse(bulkResponse.hasFailures());
671671
}
672672
{
@@ -679,7 +679,7 @@ public void testBulk() throws Exception {
679679
.source(XContentType.JSON,"field", "baz"));
680680
// end::bulk-request-with-mixed-operations
681681
BulkResponse bulkResponse = client.bulk(request, RequestOptions.DEFAULT);
682-
assertSame(bulkResponse.status(), RestStatus.OK);
682+
assertSame(RestStatus.OK, bulkResponse.status());
683683
assertFalse(bulkResponse.hasFailures());
684684

685685
// tag::bulk-response
@@ -778,7 +778,7 @@ public void testGet() throws Exception {
778778
"postDate", new Date(),
779779
"message", "trying out Elasticsearch");
780780
IndexResponse indexResponse = client.index(indexRequest, RequestOptions.DEFAULT);
781-
assertEquals(indexResponse.getResult(), DocWriteResponse.Result.CREATED);
781+
assertEquals(DocWriteResponse.Result.CREATED, indexResponse.getResult());
782782
}
783783
{
784784
//tag::get-request

client/rest/src/main/java/org/elasticsearch/client/HasAttributeNodeSelector.java

+19
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Iterator;
2323
import java.util.List;
2424
import java.util.Map;
25+
import java.util.Objects;
2526

2627
/**
2728
* A {@link NodeSelector} that selects nodes that have a particular value
@@ -49,6 +50,24 @@ public void select(Iterable<Node> nodes) {
4950
}
5051
}
5152

53+
@Override
54+
public boolean equals(Object o) {
55+
if (this == o) {
56+
return true;
57+
}
58+
if (o == null || getClass() != o.getClass()) {
59+
return false;
60+
}
61+
HasAttributeNodeSelector that = (HasAttributeNodeSelector) o;
62+
return Objects.equals(key, that.key) &&
63+
Objects.equals(value, that.value);
64+
}
65+
66+
@Override
67+
public int hashCode() {
68+
return Objects.hash(key, value);
69+
}
70+
5271
@Override
5372
public String toString() {
5473
return key + "=" + value;

distribution/packages/src/common/scripts/preinst

+12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
# $1=1 : indicates an new install
1010
# $1=2 : indicates an upgrade
1111

12+
# Check for these at preinst time due to failures in postinst if they do not exist
13+
if [ -x "$JAVA_HOME/bin/java" ]; then
14+
JAVA="$JAVA_HOME/bin/java"
15+
else
16+
JAVA=`which java`
17+
fi
18+
19+
if [ -z "$JAVA" ]; then
20+
echo "could not find java; set JAVA_HOME or ensure java is in PATH"
21+
exit 1
22+
fi
23+
1224
case "$1" in
1325

1426
# Debian ####################################################

docs/java-api/aggregations/metrics/scripted-metric-aggregation.asciidoc

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Here is an example on how to create the aggregation request:
1313
--------------------------------------------------
1414
ScriptedMetricAggregationBuilder aggregation = AggregationBuilders
1515
.scriptedMetric("agg")
16-
.initScript(new Script("params._agg.heights = []"))
17-
.mapScript(new Script("params._agg.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"));
16+
.initScript(new Script("state.heights = []"))
17+
.mapScript(new Script("state.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"));
1818
--------------------------------------------------
1919

2020
You can also specify a `combine` script which will be executed on each shard:
@@ -23,9 +23,9 @@ You can also specify a `combine` script which will be executed on each shard:
2323
--------------------------------------------------
2424
ScriptedMetricAggregationBuilder aggregation = AggregationBuilders
2525
.scriptedMetric("agg")
26-
.initScript(new Script("params._agg.heights = []"))
27-
.mapScript(new Script("params._agg.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"))
28-
.combineScript(new Script("double heights_sum = 0.0; for (t in params._agg.heights) { heights_sum += t } return heights_sum"));
26+
.initScript(new Script("state.heights = []"))
27+
.mapScript(new Script("state.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"))
28+
.combineScript(new Script("double heights_sum = 0.0; for (t in state.heights) { heights_sum += t } return heights_sum"));
2929
--------------------------------------------------
3030

3131
You can also specify a `reduce` script which will be executed on the node which gets the request:
@@ -34,10 +34,10 @@ You can also specify a `reduce` script which will be executed on the node which
3434
--------------------------------------------------
3535
ScriptedMetricAggregationBuilder aggregation = AggregationBuilders
3636
.scriptedMetric("agg")
37-
.initScript(new Script("params._agg.heights = []"))
38-
.mapScript(new Script("params._agg.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"))
39-
.combineScript(new Script("double heights_sum = 0.0; for (t in params._agg.heights) { heights_sum += t } return heights_sum"))
40-
.reduceScript(new Script("double heights_sum = 0.0; for (a in params._aggs) { heights_sum += a } return heights_sum"));
37+
.initScript(new Script("state.heights = []"))
38+
.mapScript(new Script("state.heights.add(doc.gender.value == 'male' ? doc.height.value : -1.0 * doc.height.value)"))
39+
.combineScript(new Script("double heights_sum = 0.0; for (t in state.heights) { heights_sum += t } return heights_sum"))
40+
.reduceScript(new Script("double heights_sum = 0.0; for (a in states) { heights_sum += a } return heights_sum"));
4141
--------------------------------------------------
4242

4343

docs/reference/aggregations/bucket/composite-aggregation.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Time values can also be specified via abbreviations supported by <<time-units,ti
224224
Note that fractional time values are not supported, but you can address this by shifting to another
225225
time unit (e.g., `1.5h` could instead be specified as `90m`).
226226

227-
====== Format
227+
*Format*
228228

229229
Internally, a date is represented as a 64 bit number representing a timestamp in milliseconds-since-the-epoch.
230230
These timestamps are returned as the bucket keys. It is possible to return a formatted date string instead using
@@ -257,7 +257,7 @@ GET /_search
257257

258258
<1> Supports expressive date <<date-format-pattern,format pattern>>
259259

260-
====== Time Zone
260+
*Time Zone*
261261

262262
Date-times are stored in Elasticsearch in UTC. By default, all bucketing and
263263
rounding is also done in UTC. The `time_zone` parameter can be used to indicate

0 commit comments

Comments
 (0)