Skip to content

Commit 9898d35

Browse files
committed
Merge remote-tracking branch 'es/6.x' into ccr-6.x
* es/6.x: (170 commits) Allow TrimFilter to be used in custom normalizers (#27758) recovery from snapshot should fill gaps (#27850) Remove unused class PreBuiltTokenFilters (#27839) Reject scroll query if size is 0 (#22552) (#27842) Mutes ‘Rollover no condition matched’ YAML test Make randomNonNegativeLong() draw from a uniform distribution (#27856) Adapt rest test after backport. Relates #27833 Handle case where the hole vertex is south of the containing polygon(s) (#27685) Move range field mapper back to core Fix publication of elasticsearch-cli to Maven Do not use system properties when building the HttpAsyncClient (#27829) Optimize version map for append-only indexing (#27752) Add NioGroup for use in different transports (#27737) adapt field collapsing skip test version. relates #27833 Add version support for inner hits in field collapsing (#27822) (#27833) Clarify that number of threads is set by packages Register HTTP read timeout setting Fixes Checkstyle Remove `operationThreaded` from Java API (#27836) Fixes failing BytesSizeValues tests ...
2 parents 42479c9 + 75ac1f7 commit 9898d35

File tree

649 files changed

+15199
-4904
lines changed

Some content is hidden

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

649 files changed

+15199
-4904
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,19 @@ IntelliJ users can automatically configure their IDE: `gradle idea`
106106
then `File->New Project From Existing Sources`. Point to the root of
107107
the source directory, select
108108
`Import project from external model->Gradle`, enable
109-
`Use auto-import`. Additionally, in order to run tests directly from
110-
IDEA 2017.1 and above it is required to disable IDEA run launcher,
111-
which can be achieved by adding `-Didea.no.launcher=true`
112-
[JVM option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties)
113-
109+
`Use auto-import`. In order to run tests directly from
110+
IDEA 2017.2 and above, it is required to disable the IDEA run launcher in order to avoid
111+
`idea_rt.jar` causing "jar hell". This can be achieved by adding the
112+
`-Didea.no.launcher=true` [JVM
113+
option](https://intellij-support.jetbrains.com/hc/en-us/articles/206544869-Configuring-JVM-options-and-platform-properties).
114+
Alternatively, `idea.no.launcher=true` can be set in the
115+
[`idea.properties`](https://www.jetbrains.com/help/idea/file-idea-properties.html)
116+
file which can be accessed under Help > Edit Custom Properties (this will require a
117+
restart of IDEA). For IDEA 2017.3 and above, in addition to the JVM option, you will need to go to
118+
`Run->Edit Configurations...` and change the value for the `Shorten command line` setting from
119+
`user-local default: none` to `classpath file`. You may also need to [remove `ant-javafx.jar` from your
120+
classpath](https://github.com/elastic/elasticsearch/issues/14348) if that is
121+
reported as a source of jar hell.
114122

115123
The Elasticsearch codebase makes heavy use of Java `assert`s and the
116124
test runner requires that assertions be enabled within the JVM. This

Vagrantfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,9 @@ Defaults env_keep += "BATS_ARCHIVES"
307307
SUDOERS_VARS
308308
chmod 0440 /etc/sudoers.d/elasticsearch_vars
309309
SHELL
310+
# This prevents leftovers from previous tests using the
311+
# same VM from messing up the current test
312+
config.vm.provision "clean_tmp", run: "always", type: "shell", inline: <<-SHELL
313+
rm -rf /tmp/elasticsearch*
314+
SHELL
310315
end

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ class BuildPlugin implements Plugin<Project> {
131131
throw new GradleException("${minGradle} or above is required to build elasticsearch")
132132
}
133133

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")
138-
}
139-
140134
// enforce Java version
141135
if (javaVersionEnum < minimumJava) {
142136
throw new GradleException("Java ${minimumJava} or above is required to build Elasticsearch")

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import java.util.regex.Matcher
2929
class VersionCollection {
3030

3131
private final List<Version> versions
32+
private final boolean buildSnapshot = System.getProperty("build.snapshot", "true") == "true"
3233

3334
/**
3435
* Construct a VersionCollection from the lines of the Version.java file.
@@ -63,7 +64,10 @@ class VersionCollection {
6364
throw new GradleException("Unexpectedly found no version constants in Versions.java");
6465
}
6566

66-
// The tip of each minor series (>= 5.6) is unreleased, so set their 'snapshot' flags
67+
/*
68+
* The tip of each minor series (>= 5.6) is unreleased, so they must be built from source (we set branch to non-null), and we set
69+
* the snapshot flag if and only if build.snapshot is true.
70+
*/
6771
Version prevConsideredVersion = null
6872
boolean found6xSnapshot = false
6973
for (final int versionIndex = versions.size() - 1; versionIndex >= 0; versionIndex--) {
@@ -85,7 +89,7 @@ class VersionCollection {
8589

8690
versions[versionIndex] = new Version(
8791
currConsideredVersion.major, currConsideredVersion.minor,
88-
currConsideredVersion.revision, currConsideredVersion.suffix, true, branch)
92+
currConsideredVersion.revision, currConsideredVersion.suffix, buildSnapshot, branch)
8993
}
9094

9195
if (currConsideredVersion.onOrBefore("5.6.0")) {
@@ -95,12 +99,6 @@ class VersionCollection {
9599
prevConsideredVersion = currConsideredVersion
96100
}
97101

98-
// If we're making a release build then the current should not be a snapshot after all.
99-
final boolean currentIsSnapshot = "true" == System.getProperty("build.snapshot", "true")
100-
if (false == currentIsSnapshot) {
101-
versions[-1] = new Version(versions[-1].major, versions[-1].minor, versions[-1].revision, versions[-1].suffix, false, null)
102-
}
103-
104102
this.versions = Collections.unmodifiableList(versions)
105103
}
106104

@@ -137,7 +135,7 @@ class VersionCollection {
137135
private Version getLastSnapshotWithMajor(int targetMajor) {
138136
final String currentVersion = currentVersion.toString()
139137
final int snapshotIndex = versions.findLastIndexOf {
140-
it.major == targetMajor && it.before(currentVersion) && it.snapshot
138+
it.major == targetMajor && it.before(currentVersion) && it.snapshot == buildSnapshot
141139
}
142140
return snapshotIndex == -1 ? null : versions[snapshotIndex]
143141
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public class AntFixture extends AntTask implements Fixture {
6969
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
7070
* condition is for http on the http port.
7171
*/
72-
@Input
7372
Closure waitCondition = { AntFixture fixture, AntBuilder ant ->
7473
File tmpFile = new File(fixture.cwd, 'wait.success')
7574
ant.get(src: "http://${fixture.addressAndPort}",

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

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,13 @@ class ClusterFormationTasks {
166166
Task setup = project.tasks.create(name: taskName(prefix, node, 'clean'), type: Delete, dependsOn: dependsOn) {
167167
delete node.homeDir
168168
delete node.cwd
169+
}
170+
setup = project.tasks.create(name: taskName(prefix, node, 'createCwd'), type: DefaultTask, dependsOn: setup) {
169171
doLast {
170172
node.cwd.mkdirs()
171173
}
174+
outputs.dir node.cwd
172175
}
173-
174176
setup = configureCheckPreviousTask(taskName(prefix, node, 'checkPrevious'), project, setup, node)
175177
setup = configureStopTask(taskName(prefix, node, 'stopPrevious'), project, setup, node)
176178
setup = configureExtractTask(taskName(prefix, node, 'extract'), project, setup, node, distribution)
@@ -267,33 +269,6 @@ class ClusterFormationTasks {
267269
into node.baseDir
268270
}
269271
break;
270-
case 'rpm':
271-
File rpmDatabase = new File(node.baseDir, 'rpm-database')
272-
File rpmExtracted = new File(node.baseDir, 'rpm-extracted')
273-
/* Delay reading the location of the rpm file until task execution */
274-
Object rpm = "${ -> configuration.singleFile}"
275-
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
276-
commandLine 'rpm', '--badreloc', '--nodeps', '--noscripts', '--notriggers',
277-
'--dbpath', rpmDatabase,
278-
'--relocate', "/=${rpmExtracted}",
279-
'-i', rpm
280-
doFirst {
281-
rpmDatabase.deleteDir()
282-
rpmExtracted.deleteDir()
283-
}
284-
}
285-
break;
286-
case 'deb':
287-
/* Delay reading the location of the deb file until task execution */
288-
File debExtracted = new File(node.baseDir, 'deb-extracted')
289-
Object deb = "${ -> configuration.singleFile}"
290-
extract = project.tasks.create(name: name, type: LoggedExec, dependsOn: extractDependsOn) {
291-
commandLine 'dpkg-deb', '-x', deb, debExtracted
292-
doFirst {
293-
debExtracted.deleteDir()
294-
}
295-
}
296-
break;
297272
default:
298273
throw new InvalidUserDataException("Unknown distribution: ${node.config.distribution}")
299274
}

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,6 @@
658658
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]recovery[/\\]RelocationIT.java" checks="LineLength" />
659659
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]recovery[/\\]TruncatedRecoveryIT.java" checks="LineLength" />
660660
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]BytesRestResponseTests.java" checks="LineLength" />
661-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]routing[/\\]AliasResolveRoutingIT.java" checks="LineLength" />
662661
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]routing[/\\]AliasRoutingIT.java" checks="LineLength" />
663662
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]routing[/\\]SimpleRoutingIT.java" checks="LineLength" />
664663
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]FileScriptTests.java" checks="LineLength" />

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 6.2.0
2-
lucene = 7.1.0
2+
lucene = 7.2.0-snapshot-7deca62
33

44
# optional dependencies
55
spatial4j = 0.6

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

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,25 @@
2121

2222
import org.apache.http.Header;
2323
import org.elasticsearch.action.ActionListener;
24+
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
25+
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
2426
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
2527
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
28+
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
29+
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
2630

2731
import java.io.IOException;
2832
import java.util.Collections;
2933

3034
/**
3135
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Indices API.
32-
*
36+
* <p>
3337
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html">Indices API on elastic.co</a>
3438
*/
3539
public final class IndicesClient {
3640
private final RestHighLevelClient restHighLevelClient;
3741

38-
public IndicesClient(RestHighLevelClient restHighLevelClient) {
42+
IndicesClient(RestHighLevelClient restHighLevelClient) {
3943
this.restHighLevelClient = restHighLevelClient;
4044
}
4145

@@ -56,8 +60,55 @@ public DeleteIndexResponse deleteIndex(DeleteIndexRequest deleteIndexRequest, He
5660
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html">
5761
* Delete Index API on elastic.co</a>
5862
*/
59-
public void deleteIndexAsync(DeleteIndexRequest deleteIndexRequest, ActionListener<DeleteIndexResponse> listener, Header... headers) {
63+
public void deleteIndexAsync(DeleteIndexRequest deleteIndexRequest, ActionListener<DeleteIndexResponse> listener,
64+
Header... headers) {
6065
restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, Request::deleteIndex, DeleteIndexResponse::fromXContent,
6166
listener, Collections.emptySet(), headers);
6267
}
68+
69+
/**
70+
* Creates an index using the Create Index API
71+
* <p>
72+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
73+
* Create Index API on elastic.co</a>
74+
*/
75+
public CreateIndexResponse createIndex(CreateIndexRequest createIndexRequest, Header... headers) throws IOException {
76+
return restHighLevelClient.performRequestAndParseEntity(createIndexRequest, Request::createIndex, CreateIndexResponse::fromXContent,
77+
Collections.emptySet(), headers);
78+
}
79+
80+
/**
81+
* Asynchronously creates an index using the Create Index API
82+
* <p>
83+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
84+
* Create Index API on elastic.co</a>
85+
*/
86+
public void createIndexAsync(CreateIndexRequest createIndexRequest, ActionListener<CreateIndexResponse> listener,
87+
Header... headers) {
88+
restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest, Request::createIndex, CreateIndexResponse::fromXContent,
89+
listener, Collections.emptySet(), headers);
90+
}
91+
92+
/**
93+
* Opens an index using the Open Index API
94+
* <p>
95+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
96+
* Open Index API on elastic.co</a>
97+
*/
98+
public OpenIndexResponse openIndex(OpenIndexRequest openIndexRequest, Header... headers) throws IOException {
99+
return restHighLevelClient.performRequestAndParseEntity(openIndexRequest, Request::openIndex, OpenIndexResponse::fromXContent,
100+
Collections.emptySet(), headers);
101+
}
102+
103+
/**
104+
* Asynchronously opens an index using the Open Index API
105+
* <p>
106+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
107+
* Open Index API on elastic.co</a>
108+
*/
109+
public void openIndexAsync(OpenIndexRequest openIndexRequest, ActionListener<OpenIndexResponse> listener, Header... headers) {
110+
restHighLevelClient.performRequestAsyncAndParseEntity(openIndexRequest, Request::openIndex, OpenIndexResponse::fromXContent,
111+
listener, Collections.emptySet(), headers);
112+
}
113+
63114
}

0 commit comments

Comments
 (0)