Skip to content

Commit 4be6b0e

Browse files
committed
Merge branch 'master' into ccr
* master: [ML] Fix master node deadlock during ML daily maintenance (#31836) Build: Switch integ-test-zip to OSS-only (#31866) SQL: Remove restriction for single column grouping (#31818) Build: Fix detection of Eclipse Compiler Server (#31838) Docs: Inconsistency between description and example (#31858) Re-enable bwc tests now that #29538 has been backported and 6.x intake build succeeded. QA: build improvements related to SQL projects (#31862) [Docs] Add clarification to analysis example (#31826) Check timeZone() argument in AbstractSqlQueryRequest (#31822) SQL: Fix incorrect HAVING equality (#31820) Smaller aesthetic fixes to InternalTestCluster (#31831) [Docs] Clarify accepted sort case (#31605) Temporarily disable bwc test in order to backport #29538 Remove obsolete parameters from analyze rest spec (#31795) [Docs] Fix wrong link in Korean analyzer docs (#31815) Fix profiling of ordered terms aggs (#31814) Properly mute test involving JDK11 closes #31739 Do not return all indices if a specific alias is requested via get aliases api. (#29538) Get snapshot rest client cleanups (#31740) Docs: Explain _bulk?refresh shard targeting Fix handling of points_only with term strategy in geo_shape (#31766)
2 parents 6dd3434 + 49ba271 commit 4be6b0e

File tree

47 files changed

+632
-213
lines changed

Some content is hidden

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

47 files changed

+632
-213
lines changed

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ Map<String, String> buildMetadataMap = buildMetadataValue.tokenize(';').collectE
125125
allprojects {
126126
project.ext {
127127
// for ide hacks...
128-
isEclipse = System.getProperty("eclipse.launcher") != null || gradle.startParameter.taskNames.contains('eclipse') || gradle.startParameter.taskNames.contains('cleanEclipse')
128+
isEclipse = System.getProperty("eclipse.launcher") != null || // Detects gradle launched from Eclipse's IDE
129+
System.getProperty("eclipse.application") != null || // Detects gradle launched from the Eclipse compiler server
130+
gradle.startParameter.taskNames.contains('eclipse') || // Detects gradle launched from the command line to do eclipse stuff
131+
gradle.startParameter.taskNames.contains('cleanEclipse')
129132
isIdea = System.getProperty("idea.active") != null || gradle.startParameter.taskNames.contains('idea') || gradle.startParameter.taskNames.contains('cleanIdea')
130133

131134
// for BWC testing
@@ -446,7 +449,7 @@ allprojects {
446449

447450
File licenseHeaderFile;
448451
String prefix = ':x-pack';
449-
452+
450453
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
451454
prefix = prefix.replace(':', '_')
452455
}
@@ -455,7 +458,7 @@ allprojects {
455458
} else {
456459
licenseHeaderFile = new File(project.rootDir, 'buildSrc/src/main/resources/license-headers/oss-license-header.txt')
457460
}
458-
461+
459462
String lineSeparator = Os.isFamily(Os.FAMILY_WINDOWS) ? '\\\\r\\\\n' : '\\\\n'
460463
String licenseHeader = licenseHeaderFile.getText('UTF-8').replace(System.lineSeparator(), lineSeparator)
461464
task copyEclipseSettings(type: Copy) {

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,13 +2122,21 @@ public void testGetSnapshots() {
21222122
getSnapshotsRequest.snapshots(Arrays.asList(snapshot1, snapshot2).toArray(new String[0]));
21232123
setRandomMasterTimeout(getSnapshotsRequest, expectedParams);
21242124

2125-
boolean ignoreUnavailable = randomBoolean();
2126-
getSnapshotsRequest.ignoreUnavailable(ignoreUnavailable);
2127-
expectedParams.put("ignore_unavailable", Boolean.toString(ignoreUnavailable));
2125+
if (randomBoolean()) {
2126+
boolean ignoreUnavailable = randomBoolean();
2127+
getSnapshotsRequest.ignoreUnavailable(ignoreUnavailable);
2128+
expectedParams.put("ignore_unavailable", Boolean.toString(ignoreUnavailable));
2129+
} else {
2130+
expectedParams.put("ignore_unavailable", Boolean.FALSE.toString());
2131+
}
21282132

2129-
boolean verbose = randomBoolean();
2130-
getSnapshotsRequest.verbose(verbose);
2131-
expectedParams.put("verbose", Boolean.toString(verbose));
2133+
if (randomBoolean()) {
2134+
boolean verbose = randomBoolean();
2135+
getSnapshotsRequest.verbose(verbose);
2136+
expectedParams.put("verbose", Boolean.toString(verbose));
2137+
} else {
2138+
expectedParams.put("verbose", Boolean.TRUE.toString());
2139+
}
21322140

21332141
Request request = RequestConverters.getSnapshots(getSnapshotsRequest);
21342142
assertThat(endpoint, equalTo(request.getEndpoint()));

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
import org.elasticsearch.common.xcontent.XContentType;
4949
import org.elasticsearch.repositories.fs.FsRepository;
5050
import org.elasticsearch.rest.RestStatus;
51+
import org.elasticsearch.snapshots.SnapshotId;
5152
import org.elasticsearch.snapshots.SnapshotInfo;
53+
import org.elasticsearch.snapshots.SnapshotShardFailure;
54+
import org.elasticsearch.snapshots.SnapshotState;
5255

5356
import java.io.IOException;
5457
import java.util.HashMap;
@@ -496,7 +499,14 @@ public void testSnapshotGetSnapshots() throws IOException {
496499
// end::get-snapshots-execute
497500

498501
// tag::get-snapshots-response
499-
List<SnapshotInfo> snapshotsInfos = response.getSnapshots(); // <1>
502+
List<SnapshotInfo> snapshotsInfos = response.getSnapshots();
503+
SnapshotInfo snapshotInfo = snapshotsInfos.get(0);
504+
RestStatus restStatus = snapshotInfo.status(); // <1>
505+
SnapshotId snapshotId = snapshotInfo.snapshotId(); // <2>
506+
SnapshotState snapshotState = snapshotInfo.state(); // <3>
507+
List<SnapshotShardFailure> snapshotShardFailures = snapshotInfo.shardFailures(); // <4>
508+
long startTime = snapshotInfo.startTime(); // <5>
509+
long endTime = snapshotInfo.endTime(); // <6>
500510
// end::get-snapshots-response
501511
assertEquals(1, snapshotsInfos.size());
502512
}

distribution/archives/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Closure commonZipConfig = {
102102

103103
task buildIntegTestZip(type: Zip) {
104104
configure(commonZipConfig)
105-
with archiveFiles(transportModulesFiles, 'zip', false)
105+
with archiveFiles(transportModulesFiles, 'zip', true)
106106
}
107107

108108
task buildZip(type: Zip) {
@@ -193,7 +193,7 @@ subprojects {
193193
onlyIf toolExists
194194
doLast {
195195
final String licenseFilename
196-
if (project.name.contains('oss-')) {
196+
if (project.name.contains('oss-') || project.name == 'integ-test-zip') {
197197
licenseFilename = "APACHE-LICENSE-2.0.txt"
198198
} else {
199199
licenseFilename = "ELASTIC-LICENSE.txt"

docs/java-rest/high-level/indices/analyze.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ You can analyze text using the mappings for a particular field in an index:
5656
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[analyze-field-request]
5757
---------------------------------------------------
5858

59-
==== Optional arguemnts
59+
==== Optional arguments
6060
The following arguments can also optionally be provided:
6161

6262
["source","java",subs="attributes,callouts,macros"]

docs/java-rest/high-level/snapshot/get_snapshots.asciidoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,16 @@ argument.
9393
[[java-rest-high-snapshot-get-snapshots-response]]
9494
==== Get Snapshots Response
9595

96-
Use the `GetSnapshotsResponse` to retrieve information about the evaluated
97-
request:
96+
The returned `GetSnapshotsResponse` allows the retrieval of information about the requested
97+
snapshots:
9898

9999
["source","java",subs="attributes,callouts,macros"]
100100
--------------------------------------------------
101101
include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-response]
102102
--------------------------------------------------
103-
<1> Indicates the node has started the request.
103+
<1> The REST status of a snapshot
104+
<2> The snapshot id
105+
<3> The current state of the snapshot
106+
<4> Information about failures that occurred during the shard snapshot process.
107+
<5> The snapshot start time
108+
<6> The snapshot end time

docs/plugins/analysis-nori.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Which responds with:
268268

269269
The `nori_part_of_speech` token filter removes tokens that match a set of
270270
part-of-speech tags. The list of supported tags and their meanings can be found here:
271-
{lucene_version_path}/org/apache/lucene/analysis/ko/POS.Tag.html[Part of speech tags]
271+
{lucene-core-javadoc}/../analyzers-nori/org/apache/lucene/analysis/ko/POS.Tag.html[Part of speech tags]
272272

273273
It accepts the following setting:
274274

docs/reference/analysis.asciidoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ defined per index.
1313
[float]
1414
== Index time analysis
1515

16-
For instance at index time, the built-in <<english-analyzer,`english`>> _analyzer_ would
17-
convert this sentence:
16+
For instance, at index time the built-in <<english-analyzer,`english`>> _analyzer_
17+
will first convert the sentence:
1818

1919
[source,text]
2020
------
2121
"The QUICK brown foxes jumped over the lazy dog!"
2222
------
2323

24-
into these terms, which would be added to the inverted index.
24+
into distinct tokens. It will then lowercase each token, remove frequent
25+
stopwords ("the") and reduce the terms to their word stems (foxes -> fox,
26+
jumped -> jump, lazy -> lazi). In the end, the following terms will be added
27+
to the inverted index:
2528

2629
[source,text]
2730
------

docs/reference/docs/bulk.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ example.
230230
Control when the changes made by this request are visible to search. See
231231
<<docs-refresh,refresh>>.
232232

233+
NOTE: Only the shards that receive the bulk request will be affected by
234+
`refresh`. Imagine a `_bulk?refresh=wait_for` request with three
235+
documents in it that happen to be routed to different shards in an index
236+
with five shards. The request will only wait for those three shards to
237+
refresh. The other two shards of that make up the index do not
238+
participate in the `_bulk` request at all.
239+
233240
[float]
234241
[[bulk-update]]
235242
=== Update

docs/reference/indices/aliases.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ The rest endpoint is: `/{index}/_alias/{alias}`.
486486
[float]
487487
==== Examples:
488488

489-
All aliases for the index users:
489+
All aliases for the index `logs_20162801`:
490490

491491
[source,js]
492492
--------------------------------------------------

docs/reference/search/request/rescore.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Currently the rescore API has only one implementation: the query
1515
rescorer, which uses a query to tweak the scoring. In the future,
1616
alternative rescorers may be made available, for example, a pair-wise rescorer.
1717

18-
NOTE: An error will be thrown if an explicit <<search-request-sort,`sort`>> (other than `_score`)
19-
is provided with a `rescore` query.
18+
NOTE: An error will be thrown if an explicit <<search-request-sort,`sort`>>
19+
(other than `_score` in descending order) is provided with a `rescore` query.
2020

2121
NOTE: when exposing pagination to your users, you should not change
2222
`window_size` as you step through each page (by passing different

docs/reference/sql/language/syntax/select.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ And grouping by column expression (typically used along-side an alias):
177177
include-tagged::{sql-specs}/docs.csv-spec[groupByExpression]
178178
----
179179

180+
Or a mixture of the above:
181+
["source","sql",subs="attributes,callouts,macros"]
182+
----
183+
include-tagged::{sql-specs}/docs.csv-spec[groupByMulti]
184+
----
185+
186+
180187
When a `GROUP BY` clause is used in a `SELECT`, _all_ output expressions must be either aggregate functions or expressions used for grouping or derivatives of (otherwise there would be more than one possible value to return for each ungrouped column).
181188

182189
To wit:

plugins/repository-hdfs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ if (rootProject.ext.compilerJavaVersion.isJava11()) {
228228
].join(',')
229229
}
230230
}
231-
if (rootProject.ext.compilerJavaVersion.isJava11()) {
231+
if (rootProject.ext.runtimeJavaVersion.isJava11() || rootProject.ext.compilerJavaVersion.isJava11()) {
232232
// TODO remove when: https://github.com/elastic/elasticsearch/issues/31498
233233
integTestHa.enabled = false
234234
}

rest-api-spec/src/main/resources/rest-api-spec/api/indices.analyze.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@
1515
"index": {
1616
"type" : "string",
1717
"description" : "The name of the index to scope the operation"
18-
},
19-
"prefer_local": {
20-
"type" : "boolean",
21-
"description" : "With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)"
22-
},
23-
"format": {
24-
"type": "enum",
25-
"options" : ["detailed","text"],
26-
"default": "detailed",
27-
"description": "Format of the output"
2818
}
2919
}
3020
},

server/src/main/java/org/elasticsearch/action/AliasesRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ public interface AliasesRequest extends IndicesRequest.Replaceable {
3333
String[] aliases();
3434

3535
/**
36-
* Sets the array of aliases that the action relates to
36+
* Replaces current aliases with the provided aliases.
37+
*
38+
* Sometimes aliases expressions need to be resolved to concrete aliases prior to executing the transport action.
3739
*/
38-
AliasesRequest aliases(String... aliases);
40+
void replaceAliases(String... aliases);
3941

4042
/**
4143
* Returns true if wildcards expressions among aliases should be resolved, false otherwise

server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ public AliasActions index(String index) {
302302
/**
303303
* Aliases to use with this action.
304304
*/
305-
@Override
306305
public AliasActions aliases(String... aliases) {
307306
if (type == AliasActions.Type.REMOVE_INDEX) {
308307
throw new IllegalArgumentException("[aliases] is unsupported for [" + type + "]");
@@ -428,6 +427,11 @@ public String[] aliases() {
428427
return aliases;
429428
}
430429

430+
@Override
431+
public void replaceAliases(String... aliases) {
432+
this.aliases = aliases;
433+
}
434+
431435
@Override
432436
public boolean expandAliasesWildcards() {
433437
//remove operations support wildcards among aliases, add operations don't

server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesRequest.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.elasticsearch.action.admin.indices.alias.get;
2020

21+
import org.elasticsearch.Version;
2122
import org.elasticsearch.action.ActionRequestValidationException;
2223
import org.elasticsearch.action.AliasesRequest;
2324
import org.elasticsearch.action.support.IndicesOptions;
@@ -32,15 +33,12 @@ public class GetAliasesRequest extends MasterNodeReadRequest<GetAliasesRequest>
3233

3334
private String[] indices = Strings.EMPTY_ARRAY;
3435
private String[] aliases = Strings.EMPTY_ARRAY;
35-
3636
private IndicesOptions indicesOptions = IndicesOptions.strictExpand();
37+
private String[] originalAliases = Strings.EMPTY_ARRAY;
3738

38-
public GetAliasesRequest(String[] aliases) {
39+
public GetAliasesRequest(String... aliases) {
3940
this.aliases = aliases;
40-
}
41-
42-
public GetAliasesRequest(String alias) {
43-
this.aliases = new String[]{alias};
41+
this.originalAliases = aliases;
4442
}
4543

4644
public GetAliasesRequest() {
@@ -51,6 +49,9 @@ public GetAliasesRequest(StreamInput in) throws IOException {
5149
indices = in.readStringArray();
5250
aliases = in.readStringArray();
5351
indicesOptions = IndicesOptions.readIndicesOptions(in);
52+
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
53+
originalAliases = in.readStringArray();
54+
}
5455
}
5556

5657
@Override
@@ -59,6 +60,9 @@ public void writeTo(StreamOutput out) throws IOException {
5960
out.writeStringArray(indices);
6061
out.writeStringArray(aliases);
6162
indicesOptions.writeIndicesOptions(out);
63+
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
64+
out.writeStringArray(originalAliases);
65+
}
6266
}
6367

6468
@Override
@@ -67,9 +71,9 @@ public GetAliasesRequest indices(String... indices) {
6771
return this;
6872
}
6973

70-
@Override
7174
public GetAliasesRequest aliases(String... aliases) {
7275
this.aliases = aliases;
76+
this.originalAliases = aliases;
7377
return this;
7478
}
7579

@@ -88,6 +92,18 @@ public String[] aliases() {
8892
return aliases;
8993
}
9094

95+
@Override
96+
public void replaceAliases(String... aliases) {
97+
this.aliases = aliases;
98+
}
99+
100+
/**
101+
* Returns the aliases as was originally specified by the user
102+
*/
103+
public String[] getOriginalAliases() {
104+
return originalAliases;
105+
}
106+
91107
@Override
92108
public boolean expandAliasesWildcards() {
93109
return true;

server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.elasticsearch.threadpool.ThreadPool;
3434
import org.elasticsearch.transport.TransportService;
3535

36+
import java.util.Collections;
3637
import java.util.List;
3738

3839
public class TransportGetAliasesAction extends TransportMasterNodeReadAction<GetAliasesRequest, GetAliasesResponse> {
@@ -62,7 +63,24 @@ protected GetAliasesResponse newResponse() {
6263
@Override
6364
protected void masterOperation(GetAliasesRequest request, ClusterState state, ActionListener<GetAliasesResponse> listener) {
6465
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request);
65-
ImmutableOpenMap<String, List<AliasMetaData>> result = state.metaData().findAliases(request.aliases(), concreteIndices);
66-
listener.onResponse(new GetAliasesResponse(result));
66+
ImmutableOpenMap<String, List<AliasMetaData>> aliases = state.metaData().findAliases(request.aliases(), concreteIndices);
67+
listener.onResponse(new GetAliasesResponse(postProcess(request, concreteIndices, aliases)));
6768
}
69+
70+
/**
71+
* Fills alias result with empty entries for requested indices when no specific aliases were requested.
72+
*/
73+
static ImmutableOpenMap<String, List<AliasMetaData>> postProcess(GetAliasesRequest request, String[] concreteIndices,
74+
ImmutableOpenMap<String, List<AliasMetaData>> aliases) {
75+
boolean noAliasesSpecified = request.getOriginalAliases() == null || request.getOriginalAliases().length == 0;
76+
ImmutableOpenMap.Builder<String, List<AliasMetaData>> mapBuilder = ImmutableOpenMap.builder(aliases);
77+
for (String index : concreteIndices) {
78+
if (aliases.get(index) == null && noAliasesSpecified) {
79+
List<AliasMetaData> previous = mapBuilder.put(index, Collections.emptyList());
80+
assert previous == null;
81+
}
82+
}
83+
return mapBuilder.build();
84+
}
85+
6886
}

0 commit comments

Comments
 (0)