Skip to content

Commit 5ae7d4e

Browse files
Merge remote-tracking branch 'elastic/master' into repo-setting-fixes
2 parents 0a58ae9 + 6a5d9d9 commit 5ae7d4e

File tree

286 files changed

+4345
-3548
lines changed

Some content is hidden

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

286 files changed

+4345
-3548
lines changed

TESTING.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,3 +631,13 @@ inside `/etc/hosts`, e.g.:
631631
255.255.255.255 broadcasthost
632632
::1 localhost ElasticMBP.local`
633633
....
634+
635+
== Benchmarking
636+
637+
For changes that might affect the performance characteristics of Elasticsearch
638+
you should also run macrobenchmarks. We maintain a macrobenchmarking tool
639+
called https://github.com/elastic/rally[Rally]
640+
which you can use to measure the performance impact. It comes with a set of
641+
default benchmarks that we also
642+
https://elasticsearch-benchmarks.elastic.co/[run every night]. To get started,
643+
please see https://esrally.readthedocs.io/en/stable/[Rally's documentation].

benchmarks/src/main/java/org/elasticsearch/benchmark/time/DateFormatterBenchmark.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,3 @@ public TemporalAccessor parseJodaDate() {
5555
return jodaFormatter.parse("1234567890");
5656
}
5757
}
58-

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class BuildPlugin implements Plugin<Project> {
392392
static void requireJavaHome(Task task, int version) {
393393
Project rootProject = task.project.rootProject // use root project for global accounting
394394
if (rootProject.hasProperty('requiredJavaVersions') == false) {
395-
rootProject.rootProject.ext.requiredJavaVersions = [:].withDefault{key -> return []}
395+
rootProject.rootProject.ext.requiredJavaVersions = [:]
396396
rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
397397
List<String> messages = []
398398
for (entry in rootProject.requiredJavaVersions) {
@@ -415,7 +415,7 @@ class BuildPlugin implements Plugin<Project> {
415415
throw new GradleException("JAVA${version}_HOME required to run task:\n${task}")
416416
}
417417
} else {
418-
rootProject.requiredJavaVersions.get(version).add(task)
418+
rootProject.requiredJavaVersions.getOrDefault(version, []).add(task)
419419
}
420420
}
421421

buildSrc/src/main/java/org/elasticsearch/gradle/testfixtures/TestFixturesPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void apply(Project project) {
9696
if (dockerComposeSupported(project) == false) {
9797
project.getLogger().warn(
9898
"Tests for {} require docker-compose at /usr/local/bin/docker-compose or /usr/bin/docker-compose " +
99-
"but none could not be found so these will be skipped", project.getPath()
99+
"but none could be found so these will be skipped", project.getPath()
100100
);
101101
tasks.withType(getTaskClass("com.carrotsearch.gradle.junit4.RandomizedTestingTask"), task ->
102102
task.setEnabled(false)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ public void testIndexPutSettings() throws IOException {
11771177
createIndex(index, Settings.EMPTY);
11781178

11791179
assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue));
1180-
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest();
1180+
UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest(index);
11811181
dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build());
11821182
AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings,
11831183
highLevelClient().indices()::putSettingsAsync);
@@ -1187,7 +1187,7 @@ public void testIndexPutSettings() throws IOException {
11871187
assertThat(indexSettingsAsMap.get(dynamicSettingKey), equalTo(String.valueOf(dynamicSettingValue)));
11881188

11891189
assertThat(staticSetting.getDefault(Settings.EMPTY), not(staticSettingValue));
1190-
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest();
1190+
UpdateSettingsRequest staticSettingRequest = new UpdateSettingsRequest(index);
11911191
staticSettingRequest.settings(Settings.builder().put(staticSettingKey, staticSettingValue).build());
11921192
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> execute(staticSettingRequest,
11931193
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));
@@ -1207,7 +1207,7 @@ public void testIndexPutSettings() throws IOException {
12071207
assertThat(indexSettingsAsMap.get(staticSettingKey), equalTo(staticSettingValue));
12081208

12091209
assertThat(unmodifiableSetting.getDefault(Settings.EMPTY), not(unmodifiableSettingValue));
1210-
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest();
1210+
UpdateSettingsRequest unmodifiableSettingRequest = new UpdateSettingsRequest(index);
12111211
unmodifiableSettingRequest.settings(Settings.builder().put(unmodifiableSettingKey, unmodifiableSettingValue).build());
12121212
exception = expectThrows(ElasticsearchException.class, () -> execute(unmodifiableSettingRequest,
12131213
highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync));

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919

2020
package org.elasticsearch.client.indices;
2121

22-
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
2322
import org.elasticsearch.common.xcontent.XContentBuilder;
2423
import org.elasticsearch.common.xcontent.XContentParser;
2524
import org.elasticsearch.index.RandomCreateIndexGenerator;
2625
import org.elasticsearch.test.AbstractXContentTestCase;
2726

2827
import java.io.IOException;
28+
import java.util.Map;
2929

30-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37654")
3130
public class PutMappingRequestTests extends AbstractXContentTestCase<PutMappingRequest> {
3231

3332
@Override
@@ -47,7 +46,10 @@ protected PutMappingRequest createTestInstance() {
4746
@Override
4847
protected PutMappingRequest doParseInstance(XContentParser parser) throws IOException {
4948
PutMappingRequest request = new PutMappingRequest();
50-
request.source(parser.map());
49+
Map<String, Object> map = parser.map();
50+
if (map.isEmpty() == false) {
51+
request.source(map);
52+
}
5153
return request;
5254
}
5355

@@ -58,11 +60,16 @@ protected boolean supportsUnknownFields() {
5860

5961
@Override
6062
protected void assertEqualInstances(PutMappingRequest expected, PutMappingRequest actual) {
61-
try (XContentParser expectedJson = createParser(expected.xContentType().xContent(), expected.source());
62-
XContentParser actualJson = createParser(actual.xContentType().xContent(), actual.source())) {
63-
assertEquals(expectedJson.mapOrdered(), actualJson.mapOrdered());
64-
} catch (IOException e) {
65-
throw new RuntimeException(e);
63+
if (actual.source() != null) {
64+
try (XContentParser expectedJson = createParser(expected.xContentType().xContent(), expected.source());
65+
XContentParser actualJson = createParser(actual.xContentType().xContent(), actual.source())) {
66+
assertEquals(expectedJson.mapOrdered(), actualJson.mapOrdered());
67+
} catch (IOException e) {
68+
throw new RuntimeException(e);
69+
}
70+
} else {
71+
// if the original `source` is null, the parsed source should be so too
72+
assertNull(expected.source());
6673
}
6774
}
6875
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public HttpEntity getEntity() {
103103
private static final Pattern WARNING_HEADER_PATTERN = Pattern.compile(
104104
"299 " + // warn code
105105
"Elasticsearch-\\d+\\.\\d+\\.\\d+(?:-(?:alpha|beta|rc)\\d+)?(?:-SNAPSHOT)?-(?:[a-f0-9]{7}|Unknown) " + // warn agent
106-
"\"((?:\t| |!|[\\x23-\\x5B]|[\\x5D-\\x7E]|[\\x80-\\xFF]|\\\\|\\\\\")*)\" " + // quoted warning value, captured
106+
"\"((?:\t| |!|[\\x23-\\x5B]|[\\x5D-\\x7E]|[\\x80-\\xFF]|\\\\|\\\\\")*)\"( " + // quoted warning value, captured
107107
// quoted RFC 1123 date format
108108
"\"" + // opening quote
109109
"(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), " + // weekday
@@ -112,7 +112,7 @@ public HttpEntity getEntity() {
112112
"\\d{4} " + // 4-digit year
113113
"\\d{2}:\\d{2}:\\d{2} " + // (two-digit hour):(two-digit minute):(two-digit second)
114114
"GMT" + // GMT
115-
"\""); // closing quote
115+
"\")?"); // closing quote (optional, since an older version can still send a warn-date)
116116

117117
/**
118118
* Returns a list of all warning headers returned in the response.

docs/reference/aggregations/bucket/adjacency-matrix-aggregation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Example:
3030

3131
[source,js]
3232
--------------------------------------------------
33-
PUT /emails/_doc/_bulk?refresh
33+
PUT /emails/_bulk?refresh
3434
{ "index" : { "_id" : 1 } }
3535
{ "accounts" : ["hillary", "sidney"]}
3636
{ "index" : { "_id" : 2 } }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Example:
99

1010
[source,js]
1111
--------------------------------------------------
12-
PUT /logs/_doc/_bulk?refresh
12+
PUT /logs/_bulk?refresh
1313
{ "index" : { "_id" : 1 } }
1414
{ "body" : "warning: page could not be rendered" }
1515
{ "index" : { "_id" : 2 } }

docs/reference/aggregations/metrics/scripted-metric-aggregation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Imagine a situation where you index the following documents into an index with 2
147147

148148
[source,js]
149149
--------------------------------------------------
150-
PUT /transactions/_doc/_bulk?refresh
150+
PUT /transactions/_bulk?refresh
151151
{"index":{"_id":1}}
152152
{"type": "sale","amount": 80}
153153
{"index":{"_id":2}}

0 commit comments

Comments
 (0)