Skip to content

Commit 3f07930

Browse files
committed
Merge branch 'master' into byte-size-value-setting-limit-error-message
* master: Build: Fix Java9 MR build (elastic#29312) Reindex: Fix error in delete-by-query rest spec (elastic#29318) Improve similarity integration. (elastic#29187) Fix some query extraction bugs. (elastic#29283) [Docs] Correct experimental note formatting Move Nullable into core (elastic#29341) [Docs] Update getting-started.asciidoc (elastic#29294) Elasticsearch 6.3.0 is now on Lucene 7.3. [DOCS] Refer back to index API for full-document updates in _update API section (elastic#28677) Fix missing comma in ingest-node.asciidoc (elastic#29343) Improve exception handling on TransportMasterNodeAction (elastic#29314) Don't break allocation if resize source index is missing (elastic#29311) Use fixture to test repository-s3 plugin (elastic#29296) Fix NDCG for empty search results (elastic#29267) Pass through script params in scripted metric agg (elastic#29154) Fix Eclipse build. Upgrade to lucene-7.3.0-snapshot-98a6b3d. (elastic#29298) Painless: Remove extraneous INLINE constant. (elastic#29340) Remove HTTP max content length leniency (elastic#29337) Begin moving XContent to a separate lib/artifact (elastic#29300)
2 parents 6165037 + 7c6d5cb commit 3f07930

File tree

226 files changed

+2571
-1576
lines changed

Some content is hidden

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

226 files changed

+2571
-1576
lines changed

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ subprojects {
196196
"org.elasticsearch:elasticsearch-cli:${version}": ':server:cli',
197197
"org.elasticsearch:elasticsearch-core:${version}": ':libs:elasticsearch-core',
198198
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:elasticsearch-nio',
199+
"org.elasticsearch:elasticsearch-x-content:${version}": ':libs:x-content',
199200
"org.elasticsearch:elasticsearch-secure-sm:${version}": ':libs:secure-sm',
200201
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
201202
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class BuildPlugin implements Plugin<Project> {
551551
if (project.licenseFile == null || project.noticeFile == null) {
552552
throw new GradleException("Must specify license and notice file for project ${project.path}")
553553
}
554-
jarTask.into('META-INF') {
554+
jarTask.metaInf {
555555
from(project.licenseFile.parent) {
556556
include project.licenseFile.name
557557
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class PluginBuildPlugin extends BuildPlugin {
9595
// we "upgrade" these optional deps to provided for plugins, since they will run
9696
// with a full elasticsearch server that includes optional deps
9797
compileOnly "org.locationtech.spatial4j:spatial4j:${project.versions.spatial4j}"
98-
compileOnly "com.vividsolutions:jts:${project.versions.jts}"
98+
compileOnly "org.locationtech.jts:jts-core:${project.versions.jts}"
9999
compileOnly "org.apache.logging.log4j:log4j-api:${project.versions.log4j}"
100100
compileOnly "org.apache.logging.log4j:log4j-core:${project.versions.log4j}"
101101
compileOnly "org.elasticsearch:jna:${project.versions.jna}"

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy

+17-25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.elasticsearch.gradle.precommit
2020

21+
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
2122
import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin
2223
import org.gradle.api.Project
2324
import org.gradle.api.Task
@@ -83,17 +84,14 @@ class PrecommitTasks {
8384
getClass().getResource('/forbidden/es-all-signatures.txt')]
8485
suppressAnnotations = ['**.SuppressForbidden']
8586
}
86-
Task mainForbidden = project.tasks.findByName('forbiddenApisMain')
87-
if (mainForbidden != null) {
88-
mainForbidden.configure {
89-
signaturesURLs += getClass().getResource('/forbidden/es-server-signatures.txt')
90-
}
91-
}
92-
Task testForbidden = project.tasks.findByName('forbiddenApisTest')
93-
if (testForbidden != null) {
94-
testForbidden.configure {
95-
signaturesURLs += getClass().getResource('/forbidden/es-test-signatures.txt')
96-
signaturesURLs += getClass().getResource('/forbidden/http-signatures.txt')
87+
project.tasks.withType(CheckForbiddenApis) {
88+
// we do not use the += operator to add signatures, as conventionMappings of Gradle do not work when it's configured using withType:
89+
if (name.endsWith('Test')) {
90+
signaturesURLs = project.forbiddenApis.signaturesURLs +
91+
[ getClass().getResource('/forbidden/es-test-signatures.txt'), getClass().getResource('/forbidden/http-signatures.txt') ]
92+
} else {
93+
signaturesURLs = project.forbiddenApis.signaturesURLs +
94+
[ getClass().getResource('/forbidden/es-server-signatures.txt') ]
9795
}
9896
}
9997
Task forbiddenApis = project.tasks.findByName('forbiddenApis')
@@ -144,21 +142,15 @@ class PrecommitTasks {
144142
]
145143
toolVersion = 7.5
146144
}
147-
for (String taskName : ['checkstyleMain', 'checkstyleJava9', 'checkstyleTest']) {
148-
Task task = project.tasks.findByName(taskName)
149-
if (task != null) {
150-
project.tasks['check'].dependsOn.remove(task)
151-
checkstyleTask.dependsOn(task)
152-
task.dependsOn(copyCheckstyleConf)
153-
task.inputs.file(checkstyleSuppressions)
154-
task.reports {
155-
html.enabled false
156-
}
157-
}
158-
}
159145

160-
project.tasks.withType(Checkstyle) {
161-
dependsOn(copyCheckstyleConf)
146+
project.tasks.withType(Checkstyle) { task ->
147+
project.tasks[JavaBasePlugin.CHECK_TASK_NAME].dependsOn.remove(task)
148+
checkstyleTask.dependsOn(task)
149+
task.dependsOn(copyCheckstyleConf)
150+
task.inputs.file(checkstyleSuppressions)
151+
task.reports {
152+
html.enabled false
153+
}
162154
}
163155

164156
return checkstyleTask

buildSrc/src/main/resources/checkstyle_suppressions.xml

-2
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@
248248
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]concurrent[/\\]EsExecutors.java" checks="LineLength" />
249249
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]concurrent[/\\]ThreadBarrier.java" checks="LineLength" />
250250
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]concurrent[/\\]ThreadContext.java" checks="LineLength" />
251-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]xcontent[/\\]XContentFactory.java" checks="LineLength" />
252251
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]xcontent[/\\]XContentHelper.java" checks="LineLength" />
253-
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]xcontent[/\\]smile[/\\]SmileXContent.java" checks="LineLength" />
254252
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]Discovery.java" checks="LineLength" />
255253
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]DiscoverySettings.java" checks="LineLength" />
256254
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]zen[/\\]ZenDiscovery.java" checks="LineLength" />

buildSrc/version.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
elasticsearch = 7.0.0-alpha1
2-
lucene = 7.2.1
2+
lucene = 7.3.0-snapshot-98a6b3d
33

44
# optional dependencies
5-
spatial4j = 0.6
6-
jts = 1.13
5+
spatial4j = 0.7
6+
jts = 1.15.0
77
jackson = 2.8.10
88
snakeyaml = 1.17
99
# when updating log4j, please update also docs/java-api/index.asciidoc

docs/Versions.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:version: 7.0.0-alpha1
22
:major-version: 7.x
3-
:lucene_version: 7.2.1
4-
:lucene_version_path: 7_2_1
3+
:lucene_version: 7.3.0
4+
:lucene_version_path: 7_3_0
55
:branch: master
66
:jdk: 1.8.0_131
77
:jdk_major: 8

docs/java-api/query-dsl/geo-shape-query.asciidoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ to your classpath in order to use this type:
1212
<dependency>
1313
<groupId>org.locationtech.spatial4j</groupId>
1414
<artifactId>spatial4j</artifactId>
15-
<version>0.6</version> <1>
15+
<version>0.7</version> <1>
1616
</dependency>
1717
1818
<dependency>
19-
<groupId>com.vividsolutions</groupId>
20-
<artifactId>jts</artifactId>
21-
<version>1.13</version> <2>
19+
<groupId>org.locationtech.jts</groupId>
20+
<artifactId>jts-core</artifactId>
21+
<version>1.15.0</version> <2>
2222
<exclusions>
2323
<exclusion>
2424
<groupId>xerces</groupId>
@@ -28,7 +28,7 @@ to your classpath in order to use this type:
2828
</dependency>
2929
-----------------------------------------------
3030
<1> check for updates in http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.locationtech.spatial4j%22%20AND%20a%3A%22spatial4j%22[Maven Central]
31-
<2> check for updates in http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.vividsolutions%22%20AND%20a%3A%22jts%22[Maven Central]
31+
<2> check for updates in http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.locationtech.jts%22%20AND%20a%3A%22jts-core%22[Maven Central]
3232

3333
[source,java]
3434
--------------------------------------------------

docs/reference/docs/update.asciidoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ POST test/_doc/1/_update
118118

119119
The update API also support passing a partial document,
120120
which will be merged into the existing document (simple recursive merge,
121-
inner merging of objects, replacing core "keys/values" and arrays). For
122-
example:
121+
inner merging of objects, replacing core "keys/values" and arrays).
122+
To fully replace the existing document, the <<docs-index_,`index` API>> should
123+
be used instead.
124+
The following partial update adds a new field to the
125+
existing document:
123126

124127
[source,js]
125128
--------------------------------------------------

docs/reference/getting-started.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ GET /bank/_search
777777
// CONSOLE
778778
// TEST[continued]
779779

780-
The difference here is that instead of passing `q=*` in the URI, we POST a JSON-style query request body to the `_search` API. We'll discuss this JSON query in the next section.
780+
The difference here is that instead of passing `q=*` in the URI, we provide a JSON-style query request body to the `_search` API. We'll discuss this JSON query in the next section.
781781

782782
////
783783
Hidden response just so we can assert that it is indeed the same but don't have

docs/reference/index-modules/similarity.asciidoc

+2-16
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,6 @@ This similarity has the following options:
8282

8383
Type name: `BM25`
8484

85-
[float]
86-
[[classic-similarity]]
87-
==== Classic similarity
88-
89-
The classic similarity that is based on the TF/IDF model. This
90-
similarity has the following option:
91-
92-
`discount_overlaps`::
93-
Determines whether overlap tokens (Tokens with
94-
0 position increment) are ignored when computing norm. By default this
95-
is true, meaning overlap tokens do not count when computing norms.
96-
97-
Type name: `classic`
98-
9985
[float]
10086
[[dfr]]
10187
==== DFR similarity
@@ -541,7 +527,7 @@ PUT /index
541527
"index": {
542528
"similarity": {
543529
"default": {
544-
"type": "classic"
530+
"type": "boolean"
545531
}
546532
}
547533
}
@@ -563,7 +549,7 @@ PUT /index/_settings
563549
"index": {
564550
"similarity": {
565551
"default": {
566-
"type": "classic"
552+
"type": "boolean"
567553
}
568554
}
569555
}

docs/reference/ingest/ingest-node.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ Here is an example of a pipeline specifying custom pattern definitions:
13411341
{
13421342
"grok": {
13431343
"field": "message",
1344-
"patterns": ["my %{FAVORITE_DOG:dog} is colored %{RGB:color}"]
1344+
"patterns": ["my %{FAVORITE_DOG:dog} is colored %{RGB:color}"],
13451345
"pattern_definitions" : {
13461346
"FAVORITE_DOG" : "beagle",
13471347
"RGB" : "RED|GREEN|BLUE"

docs/reference/mapping/params/similarity.asciidoc

+2-7
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ PUT my_index
4444
"default_field": { <1>
4545
"type": "text"
4646
},
47-
"classic_field": {
48-
"type": "text",
49-
"similarity": "classic" <2>
50-
},
5147
"boolean_sim_field": {
5248
"type": "text",
53-
"similarity": "boolean" <3>
49+
"similarity": "boolean" <2>
5450
}
5551
}
5652
}
@@ -59,5 +55,4 @@ PUT my_index
5955
--------------------------------------------------
6056
// CONSOLE
6157
<1> The `default_field` uses the `BM25` similarity.
62-
<2> The `classic_field` uses the `classic` similarity (ie TF/IDF).
63-
<3> The `boolean_sim_field` uses the `boolean` similarity.
58+
<2> The `boolean_sim_field` uses the `boolean` similarity.

docs/reference/migration/migrate_7_0/mappings.asciidoc

+13
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ the index setting `index.mapping.nested_objects.limit`.
2424
==== The `update_all_types` option has been removed
2525

2626
This option is useless now that all indices have at most one type.
27+
28+
=== The `classic` similarity has been removed
29+
30+
The `classic` similarity relied on coordination factors for scoring to be good
31+
in presence of stopwords in the query. This feature has been removed from
32+
Lucene, which means that the `classic` similarity now produces scores of lower
33+
quality. It is advised to switch to `BM25` instead, which is widely accepted
34+
as a better alternative.
35+
36+
=== Similarities fail when unsupported options are provided
37+
38+
An error will now be thrown when unknown configuration options are provided
39+
to similarities. Such unknown parameters were ignored before.

docs/reference/modules/http.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ from the outside. Defaults to the actual port assigned via `http.port`.
3939
|`http.host` |Used to set the `http.bind_host` and the `http.publish_host` Defaults to `http.host` or `network.host`.
4040

4141
|`http.max_content_length` |The max content of an HTTP request. Defaults to
42-
`100mb`. If set to greater than `Integer.MAX_VALUE`, it will be reset to 100mb.
42+
`100mb`.
4343

4444
|`http.max_initial_line_length` |The max length of an HTTP URL. Defaults
4545
to `4kb`

docs/reference/search/rank-eval.asciidoc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[[search-rank-eval]]
22
== Ranking Evaluation API
33

4-
experimental[The ranking evaluation API is experimental and may be changed or removed completely in a future release,
5-
as well as change in non-backwards compatible ways on minor versions updates. Elastic will take a best effort
6-
approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.]
4+
experimental[The ranking evaluation API is experimental and may be changed or removed completely in a future release, as well as change in non-backwards compatible ways on minor versions updates. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.]
75

86
The ranking evaluation API allows to evaluate the quality of ranked search
97
results over a set of typical search queries. Given this set of queries and a

server/src/main/java/org/elasticsearch/common/Booleans.java renamed to libs/elasticsearch-core/src/main/java/org/elasticsearch/common/Booleans.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,34 @@ public static boolean parseBoolean(String value) {
7373
throw new IllegalArgumentException("Failed to parse value [" + value + "] as only [true] or [false] are allowed.");
7474
}
7575

76+
private static boolean hasText(CharSequence str) {
77+
if (str == null || str.length() == 0) {
78+
return false;
79+
}
80+
int strLen = str.length();
81+
for (int i = 0; i < strLen; i++) {
82+
if (!Character.isWhitespace(str.charAt(i))) {
83+
return true;
84+
}
85+
}
86+
return false;
87+
}
88+
7689
/**
7790
*
7891
* @param value text to parse.
7992
* @param defaultValue The default value to return if the provided value is <code>null</code>.
8093
* @return see {@link #parseBoolean(String)}
8194
*/
8295
public static boolean parseBoolean(String value, boolean defaultValue) {
83-
if (Strings.hasText(value)) {
96+
if (hasText(value)) {
8497
return parseBoolean(value);
8598
}
8699
return defaultValue;
87100
}
88101

89102
public static Boolean parseBoolean(String value, Boolean defaultValue) {
90-
if (Strings.hasText(value)) {
103+
if (hasText(value)) {
91104
return parseBoolean(value);
92105
}
93106
return defaultValue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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.common;
21+
22+
/**
23+
* Utility class for glob-like matching
24+
*/
25+
public class Glob {
26+
27+
/**
28+
* Match a String against the given pattern, supporting the following simple
29+
* pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an
30+
* arbitrary number of pattern parts), as well as direct equality.
31+
*
32+
* @param pattern the pattern to match against
33+
* @param str the String to match
34+
* @return whether the String matches the given pattern
35+
*/
36+
public static boolean globMatch(String pattern, String str) {
37+
if (pattern == null || str == null) {
38+
return false;
39+
}
40+
int firstIndex = pattern.indexOf('*');
41+
if (firstIndex == -1) {
42+
return pattern.equals(str);
43+
}
44+
if (firstIndex == 0) {
45+
if (pattern.length() == 1) {
46+
return true;
47+
}
48+
int nextIndex = pattern.indexOf('*', firstIndex + 1);
49+
if (nextIndex == -1) {
50+
return str.endsWith(pattern.substring(1));
51+
} else if (nextIndex == 1) {
52+
// Double wildcard "**" - skipping the first "*"
53+
return globMatch(pattern.substring(1), str);
54+
}
55+
String part = pattern.substring(1, nextIndex);
56+
int partIndex = str.indexOf(part);
57+
while (partIndex != -1) {
58+
if (globMatch(pattern.substring(nextIndex), str.substring(partIndex + part.length()))) {
59+
return true;
60+
}
61+
partIndex = str.indexOf(part, partIndex + 1);
62+
}
63+
return false;
64+
}
65+
return (str.length() >= firstIndex &&
66+
pattern.substring(0, firstIndex).equals(str.substring(0, firstIndex)) &&
67+
globMatch(pattern.substring(firstIndex), str.substring(firstIndex)));
68+
}
69+
70+
}

0 commit comments

Comments
 (0)