Skip to content

Commit 45f6aed

Browse files
committed
Merge master
2 parents 194d56c + 4cffe8f commit 45f6aed

File tree

883 files changed

+26934
-8759
lines changed

Some content is hidden

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

883 files changed

+26934
-8759
lines changed

README.textile

+1-2
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ In order to create a distribution, simply run the @gradle assemble@ command in t
208208

209209
The distribution for each project will be created under the @build/distributions@ directory in that project.
210210

211-
See the "TESTING":TESTING.asciidoc file for more information about
212-
running the Elasticsearch test suite.
211+
See the "TESTING":TESTING.asciidoc file for more information about running the Elasticsearch test suite.
213212

214213
h3. Upgrading from Elasticsearch 1.x?
215214

TESTING.asciidoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ These are the linux flavors the Vagrantfile currently supports:
351351
* debian-9 aka stretch, the current debian stable distribution
352352
* centos-6
353353
* centos-7
354-
* fedora-25
355354
* fedora-26
355+
* fedora-27
356356
* oel-6 aka Oracle Enterprise Linux 6
357357
* oel-7 aka Oracle Enterprise Linux 7
358358
* sles-12
@@ -428,23 +428,23 @@ sudo -E bats $BATS_TESTS/*.bats
428428
You can also use Gradle to prepare the test environment and then starts a single VM:
429429

430430
-------------------------------------------------
431-
gradle vagrantFedora25#up
431+
gradle vagrantFedora27#up
432432
-------------------------------------------------
433433

434434
Or any of vagrantCentos6#up, vagrantCentos7#up, vagrantDebian8#up,
435-
vagrantFedora25#up, vagrantOel6#up, vagrantOel7#up, vagrantOpensuse13#up,
436-
vagrantSles12#up, vagrantUbuntu1404#up, vagrantUbuntu1604#up.
435+
vagrantDebian9#up, vagrantFedora26#up, vagrantFedora27#up, vagrantOel6#up, vagrantOel7#up,
436+
vagrantOpensuse42#up,vagrantSles12#up, vagrantUbuntu1404#up, vagrantUbuntu1604#up.
437437

438438
Once up, you can then connect to the VM using SSH from the elasticsearch directory:
439439

440440
-------------------------------------------------
441-
vagrant ssh fedora-25
441+
vagrant ssh fedora-27
442442
-------------------------------------------------
443443

444444
Or from another directory:
445445

446446
-------------------------------------------------
447-
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-25
447+
VAGRANT_CWD=/path/to/elasticsearch vagrant ssh fedora-27
448448
-------------------------------------------------
449449

450450
Note: Starting vagrant VM outside of the elasticsearch folder requires to

Vagrantfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ Vagrant.configure(2) do |config|
6060
config.vm.box = "elastic/oraclelinux-7-x86_64"
6161
rpm_common config
6262
end
63-
config.vm.define "fedora-25" do |config|
64-
config.vm.box = "elastic/fedora-25-x86_64"
65-
dnf_common config
66-
end
6763
config.vm.define "fedora-26" do |config|
6864
config.vm.box = "elastic/fedora-26-x86_64"
6965
dnf_common config
7066
end
67+
config.vm.define "fedora-27" do |config|
68+
config.vm.box = "elastic/fedora-27-x86_64"
69+
dnf_common config
70+
end
7171
config.vm.define "opensuse-42" do |config|
7272
config.vm.box = "elastic/opensuse-42-x86_64"
7373
opensuse_common config

build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ List<Version> versions = []
8181
// keep track of the previous major version's last minor, so we know where wire compat begins
8282
int prevMinorIndex = -1 // index in the versions list of the last minor from the prev major
8383
int lastPrevMinor = -1 // the minor version number from the prev major we most recently seen
84+
int prevBugfixIndex = -1 // index in the versions list of the last bugfix release from the prev major
8485
for (String line : versionLines) {
8586
/* Note that this skips alphas and betas which is fine because they aren't
8687
* compatible with anything. */
@@ -108,12 +109,19 @@ for (String line : versionLines) {
108109
lastPrevMinor = minor
109110
}
110111
}
112+
if (major == prevMajor) {
113+
prevBugfixIndex = versions.size() - 1
114+
}
111115
}
112116
}
113117
if (versions.toSorted { it.id } != versions) {
114118
println "Versions: ${versions}"
115119
throw new GradleException("Versions.java contains out of order version constants")
116120
}
121+
if (prevBugfixIndex != -1) {
122+
versions[prevBugfixIndex] = new Version(versions[prevBugfixIndex].major, versions[prevBugfixIndex].minor,
123+
versions[prevBugfixIndex].bugfix, versions[prevBugfixIndex].suffix, true)
124+
}
117125
if (currentVersion.bugfix == 0) {
118126
// If on a release branch, after the initial release of that branch, the bugfix version will
119127
// be bumped, and will be != 0. On master and N.x branches, we want to test against the
@@ -223,6 +231,7 @@ subprojects {
223231
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
224232
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
225233
"org.elasticsearch:elasticsearch:${version}": ':core',
234+
"org.elasticsearch:elasticsearch-cli:${version}": ':core:cli',
226235
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
227236
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',
228237
"org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}": ':client:rest-high-level',
@@ -261,6 +270,11 @@ subprojects {
261270
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
262271
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
263272
}
273+
} else if (indexCompatVersions[-2].snapshot) {
274+
/* This is a terrible hack for the bump to 6.0.1 which will be fixed by #27397 */
275+
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
276+
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
277+
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
264278
}
265279
project.afterEvaluate {
266280
configurations.all {

buildSrc/build.gradle

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import java.nio.file.Files
2121

22+
import org.gradle.util.GradleVersion
23+
2224
apply plugin: 'groovy'
2325

2426
group = 'org.elasticsearch.gradle'
@@ -99,9 +101,11 @@ dependencies {
99101

100102
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
101103
// Use logging dependency instead
104+
// Gradle 4.3.1 stopped releasing the logging jars to jcenter, just use the last available one
105+
GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3') ? GradleVersion.version('4.3') : GradleVersion.current()
102106

103107
dependencies {
104-
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
108+
compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}"
105109
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
106110
}
107111

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ class BuildPlugin implements Plugin<Project> {
131131
throw new GradleException("${minGradle} or above is required to build elasticsearch")
132132
}
133133

134-
final GradleVersion maxGradle = GradleVersion.version('4.2')
135-
if (currentGradleVersion >= maxGradle) {
136-
throw new GradleException("${maxGradle} or above is not compatible with the elasticsearch build")
134+
final GradleVersion gradle42 = GradleVersion.version('4.2')
135+
final GradleVersion gradle43 = GradleVersion.version('4.3')
136+
if (currentGradleVersion >= gradle42 && currentGradleVersion < gradle43) {
137+
throw new GradleException("${currentGradleVersion} is not compatible with the elasticsearch build")
137138
}
138139

139140
// enforce Java version
@@ -238,7 +239,7 @@ class BuildPlugin implements Plugin<Project> {
238239

239240
/** Return the configuration name used for finding transitive deps of the given dependency. */
240241
private static String transitiveDepConfigName(String groupId, String artifactId, String version) {
241-
return "_transitive_${groupId}:${artifactId}:${version}"
242+
return "_transitive_${groupId}_${artifactId}_${version}"
242243
}
243244

244245
/**

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ class ClusterConfiguration {
6464

6565
/**
6666
* Configuration of the setting <tt>discovery.zen.minimum_master_nodes</tt> on the nodes.
67-
* In case of more than one node, this defaults to (number of nodes / 2) + 1
67+
* In case of more than one node, this defaults to the number of nodes
6868
*/
6969
@Input
70-
Closure<Integer> minimumMasterNodes = { getNumNodes() > 1 ? getNumNodes().intdiv(2) + 1 : -1 }
70+
Closure<Integer> minimumMasterNodes = { getNumNodes() > 1 ? getNumNodes() : -1 }
7171

7272
@Input
7373
String jvmArgs = "-Xms" + System.getProperty('tests.heap.size', '512m') +

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

+12-4
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ class ClusterFormationTasks {
425425

426426
Project pluginProject = plugin.getValue()
427427
verifyProjectHasBuildPlugin(name, node.nodeVersion, project, pluginProject)
428-
String configurationName = "_plugin_${prefix}_${pluginProject.path}"
428+
String configurationName = pluginConfigurationName(prefix, pluginProject)
429429
Configuration configuration = project.configurations.findByName(configurationName)
430430
if (configuration == null) {
431431
configuration = project.configurations.create(configurationName)
@@ -454,13 +454,21 @@ class ClusterFormationTasks {
454454
return copyPlugins
455455
}
456456

457+
private static String pluginConfigurationName(final String prefix, final Project project) {
458+
return "_plugin_${prefix}_${project.path}".replace(':', '_')
459+
}
460+
461+
private static String pluginBwcConfigurationName(final String prefix, final Project project) {
462+
return "_plugin_bwc_${prefix}_${project.path}".replace(':', '_')
463+
}
464+
457465
/** Configures task to copy a plugin based on a zip file resolved using dependencies for an older version */
458466
static Task configureCopyBwcPluginsTask(String name, Project project, Task setup, NodeInfo node, String prefix) {
459467
Configuration bwcPlugins = project.configurations.getByName("${prefix}_elasticsearchBwcPlugins")
460468
for (Map.Entry<String, Project> plugin : node.config.plugins.entrySet()) {
461469
Project pluginProject = plugin.getValue()
462470
verifyProjectHasBuildPlugin(name, node.nodeVersion, project, pluginProject)
463-
String configurationName = "_plugin_bwc_${prefix}_${pluginProject.path}"
471+
String configurationName = pluginBwcConfigurationName(prefix, pluginProject)
464472
Configuration configuration = project.configurations.findByName(configurationName)
465473
if (configuration == null) {
466474
configuration = project.configurations.create(configurationName)
@@ -499,9 +507,9 @@ class ClusterFormationTasks {
499507
static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, Project plugin, String prefix) {
500508
final FileCollection pluginZip;
501509
if (node.nodeVersion != VersionProperties.elasticsearch) {
502-
pluginZip = project.configurations.getByName("_plugin_bwc_${prefix}_${plugin.path}")
510+
pluginZip = project.configurations.getByName(pluginBwcConfigurationName(prefix, plugin))
503511
} else {
504-
pluginZip = project.configurations.getByName("_plugin_${prefix}_${plugin.path}")
512+
pluginZip = project.configurations.getByName(pluginConfigurationName(prefix, plugin))
505513
}
506514
// delay reading the file location until execution time by wrapping in a closure within a GString
507515
final Object file = "${-> new File(node.pluginsTmpDir, pluginZip.singleFile.getName()).toURI().toURL().toString()}"

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class VagrantTestPlugin implements Plugin<Project> {
1919
'centos-7',
2020
'debian-8',
2121
'debian-9',
22-
'fedora-25',
2322
'fedora-26',
23+
'fedora-27',
2424
'oel-6',
2525
'oel-7',
2626
'opensuse-42',

buildSrc/version.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# When updating elasticsearch, please update 'rest' version in core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy
22
elasticsearch = 7.0.0-alpha1
3-
lucene = 7.1.0-snapshot-f33ed4ba12a
3+
lucene = 7.1.0
44

55
# optional dependencies
66
spatial4j = 0.6
77
jts = 1.13
8-
jackson = 2.8.6
9-
snakeyaml = 1.15
8+
jackson = 2.8.10
9+
snakeyaml = 1.17
1010
# when updating log4j, please update also docs/java-api/index.asciidoc
1111
log4j = 2.9.1
1212
slf4j = 1.6.2

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected void doExecute(SearchRequest request, ActionListener<SearchResponse> l
5353
new SearchHit[0], 0L, 0.0f),
5454
new InternalAggregations(Collections.emptyList()),
5555
new Suggest(Collections.emptyList()),
56-
new SearchProfileShardResults(Collections.emptyMap()), false, false, 1), "", 1, 1, 0, 0, new ShardSearchFailure[0]));
56+
new SearchProfileShardResults(Collections.emptyMap()), false, false, 1), "", 1, 1, 0, 0, ShardSearchFailure.EMPTY_ARRAY,
57+
SearchResponse.Clusters.EMPTY));
5758
}
5859
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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;
21+
22+
import org.apache.http.Header;
23+
import org.elasticsearch.action.ActionListener;
24+
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
25+
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
26+
27+
import java.io.IOException;
28+
import java.util.Collections;
29+
30+
/**
31+
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Indices API.
32+
*
33+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html">Indices API on elastic.co</a>
34+
*/
35+
public final class IndicesClient {
36+
private final RestHighLevelClient restHighLevelClient;
37+
38+
public IndicesClient(RestHighLevelClient restHighLevelClient) {
39+
this.restHighLevelClient = restHighLevelClient;
40+
}
41+
42+
/**
43+
* Deletes an index using the Delete Index API
44+
* <p>
45+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
46+
* Delete Index API on elastic.co</a>
47+
*/
48+
public DeleteIndexResponse deleteIndex(DeleteIndexRequest deleteIndexRequest, Header... headers) throws IOException {
49+
return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, Request::deleteIndex, DeleteIndexResponse::fromXContent,
50+
Collections.emptySet(), headers);
51+
}
52+
53+
/**
54+
* Asynchronously deletes an index using the Delete Index API
55+
* <p>
56+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
57+
* Delete Index API on elastic.co</a>
58+
*/
59+
public void deleteIndexAsync(DeleteIndexRequest deleteIndexRequest, ActionListener<DeleteIndexResponse> listener, Header... headers) {
60+
restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, Request::deleteIndex, DeleteIndexResponse::fromXContent,
61+
listener, Collections.emptySet(), headers);
62+
}
63+
}

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

100644100755
+23-7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.http.entity.ContentType;
3030
import org.apache.lucene.util.BytesRef;
3131
import org.elasticsearch.action.DocWriteRequest;
32+
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
3233
import org.elasticsearch.action.bulk.BulkRequest;
3334
import org.elasticsearch.action.delete.DeleteRequest;
3435
import org.elasticsearch.action.get.GetRequest;
@@ -123,6 +124,17 @@ static Request delete(DeleteRequest deleteRequest) {
123124
return new Request(HttpDelete.METHOD_NAME, endpoint, parameters.getParams(), null);
124125
}
125126

127+
static Request deleteIndex(DeleteIndexRequest deleteIndexRequest) {
128+
String endpoint = endpoint(deleteIndexRequest.indices(), Strings.EMPTY_ARRAY, "");
129+
130+
Params parameters = Params.builder();
131+
parameters.withTimeout(deleteIndexRequest.timeout());
132+
parameters.withMasterTimeout(deleteIndexRequest.masterNodeTimeout());
133+
parameters.withIndicesOptions(deleteIndexRequest.indicesOptions());
134+
135+
return new Request(HttpDelete.METHOD_NAME, endpoint, parameters.getParams(), null);
136+
}
137+
126138
static Request info() {
127139
return new Request(HttpGet.METHOD_NAME, "/", Collections.emptyMap(), null);
128140
}
@@ -179,23 +191,23 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
179191
metadata.field("_id", request.id());
180192
}
181193
if (Strings.hasLength(request.routing())) {
182-
metadata.field("_routing", request.routing());
194+
metadata.field("routing", request.routing());
183195
}
184196
if (Strings.hasLength(request.parent())) {
185-
metadata.field("_parent", request.parent());
197+
metadata.field("parent", request.parent());
186198
}
187199
if (request.version() != Versions.MATCH_ANY) {
188-
metadata.field("_version", request.version());
200+
metadata.field("version", request.version());
189201
}
190202

191203
VersionType versionType = request.versionType();
192204
if (versionType != VersionType.INTERNAL) {
193205
if (versionType == VersionType.EXTERNAL) {
194-
metadata.field("_version_type", "external");
206+
metadata.field("version_type", "external");
195207
} else if (versionType == VersionType.EXTERNAL_GTE) {
196-
metadata.field("_version_type", "external_gte");
208+
metadata.field("version_type", "external_gte");
197209
} else if (versionType == VersionType.FORCE) {
198-
metadata.field("_version_type", "force");
210+
metadata.field("version_type", "force");
199211
}
200212
}
201213

@@ -207,7 +219,7 @@ static Request bulk(BulkRequest bulkRequest) throws IOException {
207219
} else if (opType == DocWriteRequest.OpType.UPDATE) {
208220
UpdateRequest updateRequest = (UpdateRequest) request;
209221
if (updateRequest.retryOnConflict() > 0) {
210-
metadata.field("_retry_on_conflict", updateRequest.retryOnConflict());
222+
metadata.field("retry_on_conflict", updateRequest.retryOnConflict());
211223
}
212224
if (updateRequest.fetchSource() != null) {
213225
metadata.field("_source", updateRequest.fetchSource());
@@ -449,6 +461,10 @@ Params withFetchSourceContext(FetchSourceContext fetchSourceContext) {
449461
return this;
450462
}
451463

464+
Params withMasterTimeout(TimeValue masterTimeout) {
465+
return putParam("master_timeout", masterTimeout);
466+
}
467+
452468
Params withParent(String parent) {
453469
return putParam("parent", parent);
454470
}

0 commit comments

Comments
 (0)