Skip to content

Commit 57972df

Browse files
committed
Merge branch 'master' into mrjar
* master: (35 commits) Move the multi-get response tests to server Require JDK 9 for compilation (elastic#28071) Revert "[Docs] Fix Java Api index administration usage (elastic#28133)" Revert "[Docs] Fix base directory to include for put_mapping.asciidoc" Added multi get api to the high level rest client. [Docs] Clarify numeric datatype ranges (elastic#28240) [Docs] Fix base directory to include for put_mapping.asciidoc Open engine should keep only starting commit (elastic#28228) [Docs] Fix Java Api index administration usage (elastic#28133) Fix eclipse build. (elastic#28236) Never return null from Strings.tokenizeToStringArray (elastic#28224) Fallback to TransportMasterNodeAction for cluster health retries (elastic#28195) [Docs] Changes to ingest.asciidoc (elastic#28212) TEST: Update logging for testAckedIndexing [GEO] Add WKT Support to GeoBoundingBoxQueryBuilder Painless: Add whitelist extensions (elastic#28161) Fix daitch_mokotoff phonetic filter to use the dedicated Lucene filter (elastic#28225) Avoid doing redundant work when checking for self references. (elastic#26927) Fix casts in HotThreads. (elastic#27578) Ignore the `-snapshot` suffix when comparing the Lucene version in the build and the docs. (elastic#27927) ...
2 parents f80363e + e5a6984 commit 57972df

File tree

210 files changed

+2190
-690
lines changed

Some content is hidden

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

210 files changed

+2190
-690
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ subprojects {
183183
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
184184
"org.elasticsearch:elasticsearch:${version}": ':server',
185185
"org.elasticsearch:elasticsearch-cli:${version}": ':server:cli',
186+
"org.elasticsearch:elasticsearch-core:${version}": ':libs:elasticsearch-core',
186187
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:elasticsearch-nio',
187188
"org.elasticsearch.client:elasticsearch-rest-client:${version}": ':client:rest',
188189
"org.elasticsearch.client:elasticsearch-rest-client-sniffer:${version}": ':client:sniffer',

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,28 +169,24 @@ class BuildPlugin implements Plugin<Project> {
169169
project.ext.runtimeJavaVersion = project.rootProject.ext.runtimeJavaVersion
170170
}
171171

172-
/** Finds and enforces JAVA_HOME is set */
173172
private static String findCompilerJavaHome() {
174-
return findJavaHome(System.getenv('JAVA_HOME'), null)
175-
}
176-
177-
private static String findRuntimeJavaHome(final String compilerJavaHome) {
178-
return findJavaHome(System.getenv('RUNTIME_JAVA_HOME'), compilerJavaHome)
179-
}
180-
181-
private static String findJavaHome(String maybeJavaHome, String defaultJavaHome) {
182-
final String javaHome = maybeJavaHome ?: defaultJavaHome
173+
final String javaHome = System.getenv('JAVA_HOME')
183174
if (javaHome == null) {
184175
if (System.getProperty("idea.active") != null || System.getProperty("eclipse.launcher") != null) {
185176
// IntelliJ does not set JAVA_HOME, so we use the JDK that Gradle was run with
186-
javaHome = Jvm.current().javaHome
177+
return Jvm.current().javaHome
187178
} else {
188-
assert false
179+
throw new GradleException("JAVA_HOME must be set to build Elasticsearch")
189180
}
190181
}
191182
return javaHome
192183
}
193184

185+
private static String findRuntimeJavaHome(final String compilerJavaHome) {
186+
assert compilerJavaHome != null
187+
return System.getenv('RUNTIME_JAVA_HOME') ?: compilerJavaHome
188+
}
189+
194190
/** Finds printable java version of the given JAVA_HOME */
195191
private static String findJavaVersionDetails(Project project, String javaHome) {
196192
String versionInfoScript = 'print(' +
@@ -455,6 +451,8 @@ class BuildPlugin implements Plugin<Project> {
455451

456452
options.encoding = 'UTF-8'
457453
options.incremental = true
454+
455+
// TODO: use native Gradle support for --release when available (cf. https://github.com/gradle/gradle/issues/2510)
458456
options.compilerArgs << '--release' << targetCompatibilityVersion.majorVersion
459457
}
460458
}

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 7.0.0-alpha1
2-
lucene = 7.2.0
2+
lucene = 7.2.1
33

44
# optional dependencies
55
spatial4j = 0.6

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.elasticsearch.action.bulk.BulkRequest;
3636
import org.elasticsearch.action.delete.DeleteRequest;
3737
import org.elasticsearch.action.get.GetRequest;
38+
import org.elasticsearch.action.get.MultiGetRequest;
3839
import org.elasticsearch.action.index.IndexRequest;
3940
import org.elasticsearch.action.search.ClearScrollRequest;
4041
import org.elasticsearch.action.search.MultiSearchRequest;
@@ -312,6 +313,15 @@ static Request get(GetRequest getRequest) {
312313
return new Request(HttpGet.METHOD_NAME, endpoint, parameters.getParams(), null);
313314
}
314315

316+
static Request multiGet(MultiGetRequest multiGetRequest) throws IOException {
317+
Params parameters = Params.builder();
318+
parameters.withPreference(multiGetRequest.preference());
319+
parameters.withRealtime(multiGetRequest.realtime());
320+
parameters.withRefresh(multiGetRequest.refresh());
321+
HttpEntity entity = createEntity(multiGetRequest, REQUEST_BODY_CONTENT_TYPE);
322+
return new Request(HttpGet.METHOD_NAME, "/_mget", parameters.getParams(), entity);
323+
}
324+
315325
static Request index(IndexRequest indexRequest) {
316326
String method = Strings.hasLength(indexRequest.id()) ? HttpPut.METHOD_NAME : HttpPost.METHOD_NAME;
317327

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import org.elasticsearch.action.delete.DeleteResponse;
3535
import org.elasticsearch.action.get.GetRequest;
3636
import org.elasticsearch.action.get.GetResponse;
37+
import org.elasticsearch.action.get.MultiGetRequest;
38+
import org.elasticsearch.action.get.MultiGetResponse;
3739
import org.elasticsearch.action.index.IndexRequest;
3840
import org.elasticsearch.action.index.IndexResponse;
3941
import org.elasticsearch.action.main.MainRequest;
@@ -289,6 +291,25 @@ public final void getAsync(GetRequest getRequest, ActionListener<GetResponse> li
289291
performRequestAsyncAndParseEntity(getRequest, Request::get, GetResponse::fromXContent, listener, singleton(404), headers);
290292
}
291293

294+
/**
295+
* Retrieves multiple documents by id using the Multi Get API
296+
*
297+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
298+
*/
299+
public final MultiGetResponse multiGet(MultiGetRequest multiGetRequest, Header... headers) throws IOException {
300+
return performRequestAndParseEntity(multiGetRequest, Request::multiGet, MultiGetResponse::fromXContent, singleton(404), headers);
301+
}
302+
303+
/**
304+
* Asynchronously retrieves multiple documents by id using the Multi Get API
305+
*
306+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
307+
*/
308+
public void multiGetAsync(MultiGetRequest multiGetRequest, ActionListener<MultiGetResponse> listener, Header... headers) {
309+
performRequestAsyncAndParseEntity(multiGetRequest, Request::multiGet, MultiGetResponse::fromXContent, listener,
310+
singleton(404), headers);
311+
}
312+
292313
/**
293314
* Checks for the existence of a document. Returns true if it exists, false otherwise
294315
*

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import org.elasticsearch.action.delete.DeleteResponse;
3434
import org.elasticsearch.action.get.GetRequest;
3535
import org.elasticsearch.action.get.GetResponse;
36+
import org.elasticsearch.action.get.MultiGetRequest;
37+
import org.elasticsearch.action.get.MultiGetResponse;
3638
import org.elasticsearch.action.index.IndexRequest;
3739
import org.elasticsearch.action.index.IndexResponse;
3840
import org.elasticsearch.action.update.UpdateRequest;
@@ -238,6 +240,64 @@ public void testGet() throws IOException {
238240
}
239241
}
240242

243+
public void testMultiGet() throws IOException {
244+
{
245+
MultiGetRequest multiGetRequest = new MultiGetRequest();
246+
multiGetRequest.add("index", "type", "id1");
247+
multiGetRequest.add("index", "type", "id2");
248+
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
249+
assertEquals(2, response.getResponses().length);
250+
251+
assertTrue(response.getResponses()[0].isFailed());
252+
assertNull(response.getResponses()[0].getResponse());
253+
assertEquals("id1", response.getResponses()[0].getFailure().getId());
254+
assertEquals("type", response.getResponses()[0].getFailure().getType());
255+
assertEquals("index", response.getResponses()[0].getFailure().getIndex());
256+
assertEquals("Elasticsearch exception [type=index_not_found_exception, reason=no such index]",
257+
response.getResponses()[0].getFailure().getFailure().getMessage());
258+
259+
assertTrue(response.getResponses()[1].isFailed());
260+
assertNull(response.getResponses()[1].getResponse());
261+
assertEquals("id2", response.getResponses()[1].getId());
262+
assertEquals("type", response.getResponses()[1].getType());
263+
assertEquals("index", response.getResponses()[1].getIndex());
264+
assertEquals("Elasticsearch exception [type=index_not_found_exception, reason=no such index]",
265+
response.getResponses()[1].getFailure().getFailure().getMessage());
266+
}
267+
268+
String document = "{\"field\":\"value1\"}";
269+
StringEntity stringEntity = new StringEntity(document, ContentType.APPLICATION_JSON);
270+
Response r = client().performRequest("PUT", "/index/type/id1", Collections.singletonMap("refresh", "true"), stringEntity);
271+
assertEquals(201, r.getStatusLine().getStatusCode());
272+
273+
document = "{\"field\":\"value2\"}";
274+
stringEntity = new StringEntity(document, ContentType.APPLICATION_JSON);
275+
r = client().performRequest("PUT", "/index/type/id2", Collections.singletonMap("refresh", "true"), stringEntity);
276+
assertEquals(201, r.getStatusLine().getStatusCode());
277+
278+
{
279+
MultiGetRequest multiGetRequest = new MultiGetRequest();
280+
multiGetRequest.add("index", "type", "id1");
281+
multiGetRequest.add("index", "type", "id2");
282+
MultiGetResponse response = execute(multiGetRequest, highLevelClient()::multiGet, highLevelClient()::multiGetAsync);
283+
assertEquals(2, response.getResponses().length);
284+
285+
assertFalse(response.getResponses()[0].isFailed());
286+
assertNull(response.getResponses()[0].getFailure());
287+
assertEquals("id1", response.getResponses()[0].getId());
288+
assertEquals("type", response.getResponses()[0].getType());
289+
assertEquals("index", response.getResponses()[0].getIndex());
290+
assertEquals(Collections.singletonMap("field", "value1"), response.getResponses()[0].getResponse().getSource());
291+
292+
assertFalse(response.getResponses()[1].isFailed());
293+
assertNull(response.getResponses()[1].getFailure());
294+
assertEquals("id2", response.getResponses()[1].getId());
295+
assertEquals("type", response.getResponses()[1].getType());
296+
assertEquals("index", response.getResponses()[1].getIndex());
297+
assertEquals(Collections.singletonMap("field", "value2"), response.getResponses()[1].getResponse().getSource());
298+
}
299+
}
300+
241301
public void testIndex() throws IOException {
242302
final XContentType xContentType = randomFrom(XContentType.values());
243303
{

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.elasticsearch.action.bulk.BulkShardRequest;
3333
import org.elasticsearch.action.delete.DeleteRequest;
3434
import org.elasticsearch.action.get.GetRequest;
35+
import org.elasticsearch.action.get.MultiGetRequest;
3536
import org.elasticsearch.action.index.IndexRequest;
3637
import org.elasticsearch.action.search.ClearScrollRequest;
3738
import org.elasticsearch.action.search.MultiSearchRequest;
@@ -147,6 +148,59 @@ public void testGet() {
147148
getAndExistsTest(Request::get, "GET");
148149
}
149150

151+
public void testMultiGet() throws IOException {
152+
Map<String, String> expectedParams = new HashMap<>();
153+
MultiGetRequest multiGetRequest = new MultiGetRequest();
154+
if (randomBoolean()) {
155+
String preference = randomAlphaOfLength(4);
156+
multiGetRequest.preference(preference);
157+
expectedParams.put("preference", preference);
158+
}
159+
if (randomBoolean()) {
160+
multiGetRequest.realtime(randomBoolean());
161+
if (multiGetRequest.realtime() == false) {
162+
expectedParams.put("realtime", "false");
163+
}
164+
}
165+
if (randomBoolean()) {
166+
multiGetRequest.refresh(randomBoolean());
167+
if (multiGetRequest.refresh()) {
168+
expectedParams.put("refresh", "true");
169+
}
170+
}
171+
172+
int numberOfRequests = randomIntBetween(0, 32);
173+
for (int i = 0; i < numberOfRequests; i++) {
174+
MultiGetRequest.Item item =
175+
new MultiGetRequest.Item(randomAlphaOfLength(4), randomAlphaOfLength(4), randomAlphaOfLength(4));
176+
if (randomBoolean()) {
177+
item.routing(randomAlphaOfLength(4));
178+
}
179+
if (randomBoolean()) {
180+
item.parent(randomAlphaOfLength(4));
181+
}
182+
if (randomBoolean()) {
183+
item.storedFields(generateRandomStringArray(16, 8, false));
184+
}
185+
if (randomBoolean()) {
186+
item.version(randomNonNegativeLong());
187+
}
188+
if (randomBoolean()) {
189+
item.versionType(randomFrom(VersionType.values()));
190+
}
191+
if (randomBoolean()) {
192+
randomizeFetchSourceContextParams(item::fetchSourceContext, new HashMap<>());
193+
}
194+
multiGetRequest.add(item);
195+
}
196+
197+
Request request = Request.multiGet(multiGetRequest);
198+
assertEquals("GET", request.getMethod());
199+
assertEquals("/_mget", request.getEndpoint());
200+
assertEquals(expectedParams, request.getParameters());
201+
assertToXContentBody(multiGetRequest, request.getEntity());
202+
}
203+
150204
public void testDelete() {
151205
String index = randomAlphaOfLengthBetween(3, 10);
152206
String type = randomAlphaOfLengthBetween(3, 10);

client/rest/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ forbiddenApisTest {
7272
}
7373

7474
// JarHell is part of es server, which we don't want to pull in
75+
// TODO: Not anymore. Now in elasticsearch-core
7576
jarHell.enabled=false
7677

7778
namingConventions {

client/sniffer/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dependencyLicenses {
7575
}
7676

7777
// JarHell is part of es server, which we don't want to pull in
78+
// TODO: Not anymore. Now in elasticsearch-core
7879
jarHell.enabled=false
7980

8081
namingConventions {

client/test/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ forbiddenApisTest {
4949
}
5050

5151
// JarHell is part of es server, which we don't want to pull in
52+
// TODO: Not anymore. Now in elasticsearch-core
5253
jarHell.enabled=false
5354

5455
// TODO: should we have licenses for our test deps?

distribution/bwc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ if (project.hasProperty('bwcVersion')) {
119119
task buildBwcVersion(type: Exec) {
120120
dependsOn checkoutBwcBranch, writeBuildMetadata
121121
workingDir = checkoutDir
122-
if (project.rootProject.ext.runtimeJavaVersion == JavaVersion.VERSION_1_8 && ["5.6", "6.1"].contains(bwcBranch)) {
122+
if (project.rootProject.ext.runtimeJavaVersion == JavaVersion.VERSION_1_8 && ["5.6", "6.0", "6.1"].contains(bwcBranch)) {
123123
/*
124124
* If runtime Java home is set to JDK 8 and we are building branches that are officially built with JDK 8, push this to JAVA_HOME for
125125
* these builds.

docs/Versions.asciidoc

Lines changed: 2 additions & 2 deletions
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.0
4-
:lucene_version_path: 7_2_0
3+
:lucene_version: 7.2.1
4+
:lucene_version_path: 7_2_1
55
:branch: master
66
:jdk: 1.8.0_131
77
:jdk_major: 8

docs/painless/painless-types.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ to floating point types.
311311
| int | explicit | explicit | explicit | | implicit | implicit | implicit
312312
| long | explicit | explicit | explicit | explicit | | implicit | implicit
313313
| float | explicit | explicit | explicit | explicit | explicit | | implicit
314-
| float | explicit | explicit | explicit | explicit | explicit | explicit |
314+
| double | explicit | explicit | explicit | explicit | explicit | explicit |
315315
|====
316316

317317

@@ -376,7 +376,7 @@ cast would normally be required between the non-def types.
376376
def x; // Declare def variable x and set it to null
377377
x = 3; // Set the def variable x to the literal 3 with an implicit
378378
// cast from int to def
379-
double a = x; // Declare double variable y and set it to def variable x,
379+
double a = x; // Declare double variable a and set it to def variable x,
380380
// which contains a double
381381
int b = x; // ERROR: Results in a run-time error because an explicit cast is
382382
// required to cast from a double to an int

docs/reference/ingest.asciidoc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@
33

44
[partintro]
55
--
6-
You can use ingest node to pre-process documents before the actual indexing takes place.
7-
This pre-processing happens by an ingest node that intercepts bulk and index requests, applies the
8-
transformations, and then passes the documents back to the index or bulk APIs.
6+
Use an ingest node to pre-process documents before the actual document indexing happens.
7+
The ingest node intercepts bulk and index requests, it applies transformations, and it then
8+
passes the documents back to the index or bulk APIs.
99

10-
You can enable ingest on any node or even have dedicated ingest nodes. Ingest is enabled by default
11-
on all nodes. To disable ingest on a node, configure the following setting in the `elasticsearch.yml` file:
10+
All nodes enable ingest by default, so any node can handle ingest tasks. You can also create
11+
dedicated ingest nodes. To disable ingest for a node, configure the following setting in the
12+
elasticsearch.yml file:
1213

1314
[source,yaml]
1415
--------------------------------------------------
1516
node.ingest: false
1617
--------------------------------------------------
1718

18-
To pre-process documents before indexing, you <<pipeline,define a pipeline>> that specifies
19-
a series of <<ingest-processors,processors>>. Each processor transforms the document in some way.
20-
For example, you may have a pipeline that consists of one processor that removes a field from
21-
the document followed by another processor that renames a field. Configured pipelines are then stored
22-
in the <<cluster-state,cluster state>>.
19+
To pre-process documents before indexing, <<pipeline,define a pipeline>> that specifies a series of
20+
<<ingest-processors,processors>>. Each processor transforms the document in some specific way. For example, a
21+
pipeline might have one processor that removes a field from the document, followed by
22+
another processor that renames a field. The <<cluster-state,cluster state>> then stores
23+
the configured pipelines.
2324

24-
To use a pipeline, you simply specify the `pipeline` parameter on an index or bulk request to
25-
tell the ingest node which pipeline to use. For example:
25+
To use a pipeline, simply specify the `pipeline` parameter on an index or bulk request. This
26+
way, the ingest node knows which pipeline to use. For example:
2627

2728
[source,js]
2829
--------------------------------------------------

docs/reference/mapping/types/numeric.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The following numeric types are supported:
88
`integer`:: A signed 32-bit integer with a minimum value of +-2^31^+ and a maximum value of +2^31^-1+.
99
`short`:: A signed 16-bit integer with a minimum value of +-32,768+ and a maximum value of +32,767+.
1010
`byte`:: A signed 8-bit integer with a minimum value of +-128+ and a maximum value of +127+.
11-
`double`:: A double-precision 64-bit IEEE 754 floating point number.
12-
`float`:: A single-precision 32-bit IEEE 754 floating point number.
13-
`half_float`:: A half-precision 16-bit IEEE 754 floating point number.
11+
`double`:: A double-precision 64-bit IEEE 754 floating point number, restricted to finite values.
12+
`float`:: A single-precision 32-bit IEEE 754 floating point number, restricted to finite values.
13+
`half_float`:: A half-precision 16-bit IEEE 754 floating point number, restricted to finite values.
1414
`scaled_float`:: A floating point number that is backed by a `long`, scaled by a fixed `double` scaling factor.
1515

1616
Below is an example of configuring a mapping with numeric fields:

0 commit comments

Comments
 (0)