Skip to content

Commit 4fb6f0a

Browse files
committed
Merge branch '6.2' of github.com:elastic/elasticsearch into 6.2
2 parents 725d0b5 + e79d579 commit 4fb6f0a

File tree

27 files changed

+381
-83
lines changed

27 files changed

+381
-83
lines changed

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
elasticsearch = 6.2.4
1+
elasticsearch = 6.2.5
22
lucene = 7.2.1
33

44
# optional dependencies

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,13 @@ private void installPlugin(Terminal terminal, boolean isBatch, Path tmpRoot,
707707
final PluginInfo info = loadPluginInfo(terminal, tmpRoot, isBatch, env);
708708
// read optional security policy (extra permissions), if it exists, confirm or warn the user
709709
Path policy = tmpRoot.resolve(PluginInfo.ES_PLUGIN_POLICY);
710+
final Set<String> permissions;
710711
if (Files.exists(policy)) {
711-
Set<String> permissions = PluginSecurity.parsePermissions(policy, env.tmpFile());
712-
PluginSecurity.confirmPolicyExceptions(terminal, permissions, info.hasNativeController(), isBatch);
712+
permissions = PluginSecurity.parsePermissions(policy, env.tmpFile());
713+
} else {
714+
permissions = Collections.emptySet();
713715
}
716+
PluginSecurity.confirmPolicyExceptions(terminal, permissions, info.hasNativeController(), isBatch);
714717

715718
final Path destination = env.pluginsFile().resolve(info.getName());
716719
deleteOnFailure.add(destination);

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java

Lines changed: 103 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,59 @@ private Function<byte[], String> checksumAndString(final MessageDigest digest, f
11911191
return bytes -> MessageDigests.toHexString(digest.digest(bytes)) + s;
11921192
}
11931193

1194+
// checks the plugin requires a policy confirmation, and does not install when that is rejected by the user
1195+
// the plugin is installed after this method completes
1196+
private void assertPolicyConfirmation(Tuple<Path, Environment> env, String pluginZip, String... warnings) throws Exception {
1197+
for (int i = 0; i < warnings.length; ++i) {
1198+
String warning = warnings[i];
1199+
for (int j = 0; j < i; ++j) {
1200+
terminal.addTextInput("y"); // accept warnings we have already tested
1201+
}
1202+
// default answer, does not install
1203+
terminal.addTextInput("");
1204+
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
1205+
assertEquals("installation aborted by user", e.getMessage());
1206+
1207+
assertThat(terminal.getOutput(), containsString("WARNING: " + warning));
1208+
try (Stream<Path> fileStream = Files.list(env.v2().pluginsFile())) {
1209+
assertThat(fileStream.collect(Collectors.toList()), empty());
1210+
}
1211+
1212+
// explicitly do not install
1213+
terminal.reset();
1214+
for (int j = 0; j < i; ++j) {
1215+
terminal.addTextInput("y"); // accept warnings we have already tested
1216+
}
1217+
terminal.addTextInput("n");
1218+
e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
1219+
assertEquals("installation aborted by user", e.getMessage());
1220+
assertThat(terminal.getOutput(), containsString("WARNING: " + warning));
1221+
try (Stream<Path> fileStream = Files.list(env.v2().pluginsFile())) {
1222+
assertThat(fileStream.collect(Collectors.toList()), empty());
1223+
}
1224+
}
1225+
1226+
// allow installation
1227+
terminal.reset();
1228+
for (int j = 0; j < warnings.length; ++j) {
1229+
terminal.addTextInput("y");
1230+
}
1231+
installPlugin(pluginZip, env.v1());
1232+
for (String warning : warnings) {
1233+
assertThat(terminal.getOutput(), containsString("WARNING: " + warning));
1234+
}
1235+
}
1236+
1237+
public void testPolicyConfirmation() throws Exception {
1238+
Tuple<Path, Environment> env = createEnv(fs, temp);
1239+
Path pluginDir = createPluginDir(temp);
1240+
writePluginSecurityPolicy(pluginDir, "setAccessible", "setFactory");
1241+
String pluginZip = createPluginUrl("fake", pluginDir);
1242+
1243+
assertPolicyConfirmation(env, pluginZip, "plugin requires additional permissions");
1244+
assertPlugin("fake", pluginDir, env.v2());
1245+
}
1246+
11941247
public void testMetaPluginPolicyConfirmation() throws Exception {
11951248
Tuple<Path, Environment> env = createEnv(fs, temp);
11961249
Path metaDir = createPluginDir(temp);
@@ -1204,32 +1257,60 @@ public void testMetaPluginPolicyConfirmation() throws Exception {
12041257
writePlugin("fake2", fake2Dir);
12051258
String pluginZip = createMetaPluginUrl("meta-plugin", metaDir);
12061259

1207-
// default answer, does not install
1208-
terminal.addTextInput("");
1209-
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
1210-
assertEquals("installation aborted by user", e.getMessage());
1211-
assertThat(terminal.getOutput(), containsString("WARNING: plugin requires additional permissions"));
1212-
try (Stream<Path> fileStream = Files.list(env.v2().pluginsFile())) {
1213-
assertThat(fileStream.collect(Collectors.toList()), empty());
1214-
}
1260+
assertPolicyConfirmation(env, pluginZip, "plugin requires additional permissions");
1261+
assertMetaPlugin("meta-plugin", "fake1", metaDir, env.v2());
1262+
assertMetaPlugin("meta-plugin", "fake2", metaDir, env.v2());
1263+
}
12151264

1216-
// explicitly do not install
1217-
terminal.reset();
1218-
terminal.addTextInput("n");
1219-
e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
1220-
assertEquals("installation aborted by user", e.getMessage());
1221-
assertThat(terminal.getOutput(), containsString("WARNING: plugin requires additional permissions"));
1222-
try (Stream<Path> fileStream = Files.list(env.v2().pluginsFile())) {
1223-
assertThat(fileStream.collect(Collectors.toList()), empty());
1224-
}
1265+
public void testNativeControllerConfirmation() throws Exception {
1266+
Tuple<Path, Environment> env = createEnv(fs, temp);
1267+
Path pluginDir = createPluginDir(temp);
1268+
String pluginZip = createPluginUrl("fake", pluginDir, "has.native.controller", "true");
12251269

1226-
// allow installation
1227-
terminal.reset();
1228-
terminal.addTextInput("y");
1229-
installPlugin(pluginZip, env.v1());
1230-
assertThat(terminal.getOutput(), containsString("WARNING: plugin requires additional permissions"));
1270+
assertPolicyConfirmation(env, pluginZip, "plugin forks a native controller");
1271+
assertPlugin("fake", pluginDir, env.v2());
1272+
}
1273+
1274+
public void testMetaPluginNativeControllerConfirmation() throws Exception {
1275+
Tuple<Path, Environment> env = createEnv(fs, temp);
1276+
Path metaDir = createPluginDir(temp);
1277+
Path fake1Dir = metaDir.resolve("fake1");
1278+
Files.createDirectory(fake1Dir);
1279+
writePlugin("fake1", fake1Dir, "has.native.controller", "true");
1280+
Path fake2Dir = metaDir.resolve("fake2");
1281+
Files.createDirectory(fake2Dir);
1282+
writePlugin("fake2", fake2Dir);
1283+
String pluginZip = createMetaPluginUrl("meta-plugin", metaDir);
1284+
1285+
assertPolicyConfirmation(env, pluginZip, "plugin forks a native controller");
12311286
assertMetaPlugin("meta-plugin", "fake1", metaDir, env.v2());
12321287
assertMetaPlugin("meta-plugin", "fake2", metaDir, env.v2());
12331288
}
12341289

1290+
public void testNativeControllerAndPolicyConfirmation() throws Exception {
1291+
Tuple<Path, Environment> env = createEnv(fs, temp);
1292+
Path pluginDir = createPluginDir(temp);
1293+
writePluginSecurityPolicy(pluginDir, "setAccessible", "setFactory");
1294+
String pluginZip = createPluginUrl("fake", pluginDir, "has.native.controller", "true");
1295+
1296+
assertPolicyConfirmation(env, pluginZip, "plugin requires additional permissions", "plugin forks a native controller");
1297+
assertPlugin("fake", pluginDir, env.v2());
1298+
}
1299+
1300+
public void testMetaPluginNativeControllerAndPolicyConfirmation() throws Exception {
1301+
Tuple<Path, Environment> env = createEnv(fs, temp);
1302+
Path metaDir = createPluginDir(temp);
1303+
Path fake1Dir = metaDir.resolve("fake1");
1304+
Files.createDirectory(fake1Dir);
1305+
writePluginSecurityPolicy(fake1Dir, "setAccessible", "setFactory");
1306+
writePlugin("fake1", fake1Dir);
1307+
Path fake2Dir = metaDir.resolve("fake2");
1308+
Files.createDirectory(fake2Dir);
1309+
writePlugin("fake2", fake2Dir, "has.native.controller", "true");
1310+
String pluginZip = createMetaPluginUrl("meta-plugin", metaDir);
1311+
1312+
assertPolicyConfirmation(env, pluginZip, "plugin requires additional permissions", "plugin forks a native controller");
1313+
assertMetaPlugin("meta-plugin", "fake1", metaDir, env.v2());
1314+
assertMetaPlugin("meta-plugin", "fake2", metaDir, env.v2());
1315+
}
12351316
}

docs/Versions.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:version: 6.2.3
1+
:version: 6.2.4
22
:major-version: 6.x
33
:lucene_version: 7.2.1
44
:lucene_version_path: 7_2_0

docs/plugins/analysis.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ A number of analysis plugins have been contributed by our community:
5353
* https://github.com/duydo/elasticsearch-analysis-vietnamese[Vietnamese Analysis Plugin] (by Duy Do)
5454
* https://github.com/ofir123/elasticsearch-network-analysis[Network Addresses Analysis Plugin] (by Ofir123)
5555
* https://github.com/medcl/elasticsearch-analysis-string2int[String2Integer Analysis Plugin] (by Medcl)
56+
* https://github.com/ZarHenry96/elasticsearch-dandelion-plugin[Dandelion Analysis Plugin] (by ZarHenry96)
5657

5758
include::analysis-icu.asciidoc[]
5859

docs/reference/aggregations/bucket/datehistogram-aggregation.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ POST /sales/_search?size=0
2727
// CONSOLE
2828
// TEST[setup:sales]
2929

30-
Available expressions for interval: `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`, `second`
30+
Available expressions for interval: `year` (`1y`), `quarter` (`1q`), `month` (`1M`), `week` (`1w`),
31+
`day` (`1d`), `hour` (`1h`), `minute` (`1m`), `second` (`1s`)
3132

3233
Time values can also be specified via abbreviations supported by <<time-units,time units>> parsing.
3334
Note that fractional time values are not supported, but you can address this by shifting to another
34-
time unit (e.g., `1.5h` could instead be specified as `90m`).
35+
time unit (e.g., `1.5h` could instead be specified as `90m`). Also note that time intervals larger than
36+
than days do not support arbitrary values but can only be one unit large (e.g. `1y` is valid, `2y` is not).
3537

3638
[source,js]
3739
--------------------------------------------------

docs/reference/aggregations/metrics/cardinality-aggregation.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ A `single-value` metrics aggregation that calculates an approximate count of
55
distinct values. Values can be extracted either from specific fields in the
66
document or generated by a script.
77

8-
Assume you are indexing books and would like to count the unique authors that
9-
match a query:
8+
Assume you are indexing store sales and would like to count the unique number of sold products that match a query:
109

1110
[source,js]
1211
--------------------------------------------------

docs/reference/cluster/tasks.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ It is also possible to retrieve information for a particular task:
6464

6565
[source,js]
6666
--------------------------------------------------
67-
GET _tasks/task_id:1 <1>
67+
GET _tasks/node_id:1 <1>
6868
--------------------------------------------------
6969
// CONSOLE
7070
// TEST[catch:missing]

docs/reference/docs/delete-by-query.asciidoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,12 @@ executed again in order to conform to `requests_per_second`.
284284

285285
`failures`::
286286

287-
Array of all indexing failures. If this is non-empty then the request aborted
288-
because of those failures. See `conflicts` for how to prevent version conflicts
289-
from aborting the operation.
287+
Array of failures if there were any unrecoverable errors during the process. If
288+
this is non-empty then the request aborted because of those failures.
289+
Delete-by-query is implemented using batches and any failure causes the entire
290+
process to abort but all failures in the current batch are collected into the
291+
array. You can use the `conflicts` option to prevent reindex from aborting on
292+
version conflicts.
290293

291294

292295
[float]

docs/reference/docs/delete.asciidoc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ The result of the above delete operation is:
3939
[[delete-versioning]]
4040
=== Versioning
4141

42-
Each document indexed is versioned. When deleting a document, the
43-
`version` can be specified to make sure the relevant document we are
44-
trying to delete is actually being deleted and it has not changed in the
45-
meantime. Every write operation executed on a document, deletes included,
46-
causes its version to be incremented.
42+
Each document indexed is versioned. When deleting a document, the `version` can
43+
be specified to make sure the relevant document we are trying to delete is
44+
actually being deleted and it has not changed in the meantime. Every write
45+
operation executed on a document, deletes included, causes its version to be
46+
incremented. The version number of a deleted document remains available for a
47+
short time after deletion to allow for control of concurrent operations. The
48+
length of time for which a deleted document's version remains available is
49+
determined by the `index.gc_deletes` index setting and defaults to 60 seconds.
4750

4851
[float]
4952
[[delete-routing]]

0 commit comments

Comments
 (0)