Merge main into multi-project

This commit is contained in:
Tim Vernum 2025-02-25 10:33:53 +11:00
commit 77bf65d9af
283 changed files with 9470 additions and 9358 deletions

View file

@ -0,0 +1,5 @@
pr: 122860
summary: Improved error message when index field type is invalid
area: Mapping
type: enhancement
issues: []

View file

@ -0,0 +1,5 @@
pr: 123079
summary: Register `IngestGeoIpMetadata` as a NamedXContent
area: Ingest Node
type: bug
issues: []

View file

@ -0,0 +1,5 @@
pr: 123197
summary: Fix early termination in `LuceneSourceOperator`
area: ES|QL
type: bug
issues: []

View file

@ -0,0 +1,5 @@
pr: 123272
summary: Set Connect Timeout to 5s
area: Machine Learning
type: bug
issues: []

View file

@ -39,8 +39,8 @@ public class EntitlementBootstrap {
Function<Class<?>, String> pluginResolver,
Function<String, String> settingResolver,
Function<String, Stream<String>> settingGlobResolver,
Function<String, Path> repoDirResolver,
Path[] dataDirs,
Path[] sharedRepoDirs,
Path configDir,
Path libDir,
Path logsDir,
@ -51,11 +51,11 @@ public class EntitlementBootstrap {
requireNonNull(pluginResolver);
requireNonNull(settingResolver);
requireNonNull(settingGlobResolver);
requireNonNull(repoDirResolver);
requireNonNull(dataDirs);
if (dataDirs.length == 0) {
throw new IllegalArgumentException("must provide at least one data directory");
}
requireNonNull(sharedRepoDirs);
requireNonNull(configDir);
requireNonNull(libDir);
requireNonNull(logsDir);
@ -77,8 +77,8 @@ public class EntitlementBootstrap {
* @param pluginResolver a functor to map a Java Class to the plugin it belongs to (the plugin name).
* @param settingResolver a functor to resolve the value of an Elasticsearch setting.
* @param settingGlobResolver a functor to resolve a glob expression for one or more Elasticsearch settings.
* @param repoDirResolver a functor to map a repository location to its Elasticsearch path.
* @param dataDirs data directories for Elasticsearch
* @param sharedRepoDirs shared repository directories for Elasticsearch
* @param configDir the config directory for Elasticsearch
* @param libDir the lib directory for Elasticsearch
* @param tempDir the temp directory for Elasticsearch
@ -89,8 +89,8 @@ public class EntitlementBootstrap {
Function<Class<?>, String> pluginResolver,
Function<String, String> settingResolver,
Function<String, Stream<String>> settingGlobResolver,
Function<String, Path> repoDirResolver,
Path[] dataDirs,
Path[] sharedRepoDirs,
Path configDir,
Path libDir,
Path logsDir,
@ -105,8 +105,8 @@ public class EntitlementBootstrap {
pluginResolver,
settingResolver,
settingGlobResolver,
repoDirResolver,
dataDirs,
sharedRepoDirs,
configDir,
libDir,
logsDir,

View file

@ -63,8 +63,11 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.BaseDir.DATA;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.BaseDir.SHARED_REPO;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ_WRITE;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Platform.LINUX;
/**
* Called by the agent during {@code agentmain} to configure the entitlement system,
@ -138,6 +141,7 @@ public class EntitlementInitialization {
getUserHome(),
bootstrapArgs.configDir(),
bootstrapArgs.dataDirs(),
bootstrapArgs.sharedRepoDirs(),
bootstrapArgs.tempDir(),
bootstrapArgs.settingResolver(),
bootstrapArgs.settingGlobResolver()
@ -152,8 +156,8 @@ public class EntitlementInitialization {
new CreateClassLoaderEntitlement(),
new FilesEntitlement(
List.of(
FileData.ofPath(bootstrapArgs.repoDirResolver().apply(""), READ_WRITE),
FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE)
FileData.ofRelativePath(Path.of(""), SHARED_REPO, READ_WRITE),
FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE)
)
)
)
@ -175,26 +179,26 @@ public class EntitlementInitialization {
FileData.ofPath(bootstrapArgs.tempDir(), READ_WRITE),
FileData.ofPath(bootstrapArgs.configDir(), READ),
FileData.ofPath(bootstrapArgs.logsDir(), READ_WRITE),
FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE),
FileData.ofPath(bootstrapArgs.repoDirResolver().apply(""), READ_WRITE),
FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE),
FileData.ofRelativePath(Path.of(""), SHARED_REPO, READ_WRITE),
// OS release on Linux
FileData.ofPath(Path.of("/etc/os-release"), READ),
FileData.ofPath(Path.of("/etc/system-release"), READ),
FileData.ofPath(Path.of("/usr/lib/os-release"), READ),
FileData.ofPath(Path.of("/etc/os-release"), READ).withPlatform(LINUX),
FileData.ofPath(Path.of("/etc/system-release"), READ).withPlatform(LINUX),
FileData.ofPath(Path.of("/usr/lib/os-release"), READ).withPlatform(LINUX),
// read max virtual memory areas
FileData.ofPath(Path.of("/proc/sys/vm/max_map_count"), READ),
FileData.ofPath(Path.of("/proc/meminfo"), READ),
FileData.ofPath(Path.of("/proc/sys/vm/max_map_count"), READ).withPlatform(LINUX),
FileData.ofPath(Path.of("/proc/meminfo"), READ).withPlatform(LINUX),
// load averages on Linux
FileData.ofPath(Path.of("/proc/loadavg"), READ),
FileData.ofPath(Path.of("/proc/loadavg"), READ).withPlatform(LINUX),
// control group stats on Linux. cgroup v2 stats are in an unpredicable
// location under `/sys/fs/cgroup`, so unfortunately we have to allow
// read access to the entire directory hierarchy.
FileData.ofPath(Path.of("/proc/self/cgroup"), READ),
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ),
FileData.ofPath(Path.of("/proc/self/cgroup"), READ).withPlatform(LINUX),
FileData.ofPath(Path.of("/sys/fs/cgroup/"), READ).withPlatform(LINUX),
// // io stats on Linux
FileData.ofPath(Path.of("/proc/self/mountinfo"), READ),
FileData.ofPath(Path.of("/proc/diskstats"), READ)
FileData.ofPath(Path.of("/proc/self/mountinfo"), READ).withPlatform(LINUX),
FileData.ofPath(Path.of("/proc/diskstats"), READ).withPlatform(LINUX)
)
)
)
@ -210,21 +214,21 @@ public class EntitlementInitialization {
List.of(
FileData.ofPath(bootstrapArgs.configDir(), READ),
FileData.ofPath(bootstrapArgs.tempDir(), READ),
FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE)
FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE)
)
)
)
),
new Scope(
"org.apache.lucene.misc",
List.of(new FilesEntitlement(List.of(FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE))))
List.of(new FilesEntitlement(List.of(FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE))))
),
new Scope("org.apache.logging.log4j.core", List.of(new ManageThreadsEntitlement())),
new Scope(
"org.elasticsearch.nativeaccess",
List.of(
new LoadNativeLibrariesEntitlement(),
new FilesEntitlement(List.of(FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE)))
new FilesEntitlement(List.of(FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE)))
)
)
);

View file

@ -14,6 +14,7 @@ import org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlemen
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
@ -30,6 +31,10 @@ public final class FileAccessTree {
List<String> readPaths = new ArrayList<>();
List<String> writePaths = new ArrayList<>();
for (FilesEntitlement.FileData fileData : filesEntitlement.filesData()) {
var platform = fileData.platform();
if (platform != null && platform.isCurrent() == false) {
continue;
}
var mode = fileData.mode();
var paths = fileData.resolvePaths(pathLookup);
paths.forEach(path -> {
@ -46,8 +51,8 @@ public final class FileAccessTree {
readPaths.add(tempDir);
writePaths.add(tempDir);
readPaths.sort(String::compareTo);
writePaths.sort(String::compareTo);
readPaths.sort(PATH_ORDER);
writePaths.sort(PATH_ORDER);
this.readPaths = pruneSortedPaths(readPaths).toArray(new String[0]);
this.writePaths = pruneSortedPaths(writePaths).toArray(new String[0]);
@ -60,7 +65,7 @@ public final class FileAccessTree {
prunedReadPaths.add(currentPath);
for (int i = 1; i < paths.size(); ++i) {
String nextPath = paths.get(i);
if (nextPath.startsWith(currentPath) == false) {
if (isParent(currentPath, nextPath) == false) {
prunedReadPaths.add(nextPath);
currentPath = nextPath;
}
@ -88,21 +93,28 @@ public final class FileAccessTree {
// Note that toAbsolutePath produces paths separated by the default file separator,
// so on Windows, if the given path uses forward slashes, this consistently
// converts it to backslashes.
return path.toAbsolutePath().normalize().toString();
String result = path.toAbsolutePath().normalize().toString();
while (result.endsWith(FILE_SEPARATOR)) {
result = result.substring(0, result.length() - FILE_SEPARATOR.length());
}
return result;
}
private static boolean checkPath(String path, String[] paths) {
if (paths.length == 0) {
return false;
}
int ndx = Arrays.binarySearch(paths, path);
int ndx = Arrays.binarySearch(paths, path, PATH_ORDER);
if (ndx < -1) {
String maybeParent = paths[-ndx - 2];
return path.startsWith(maybeParent) && path.startsWith(FILE_SEPARATOR, maybeParent.length());
return isParent(paths[-ndx - 2], path);
}
return ndx >= 0;
}
private static boolean isParent(String maybeParent, String path) {
return path.startsWith(maybeParent) && path.startsWith(FILE_SEPARATOR, maybeParent.length());
}
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
@ -114,4 +126,30 @@ public final class FileAccessTree {
public int hashCode() {
return Objects.hash(Arrays.hashCode(readPaths), Arrays.hashCode(writePaths));
}
/**
* For our lexicographic sort trick to work correctly, we must have path separators sort before
* any other character so that files in a directory appear immediately after that directory.
* For example, we require [/a, /a/b, /a.xml] rather than the natural order [/a, /a.xml, /a/b].
*/
private static final Comparator<String> PATH_ORDER = (s1, s2) -> {
Path p1 = Path.of(s1);
Path p2 = Path.of(s2);
var i1 = p1.iterator();
var i2 = p2.iterator();
while (i1.hasNext() && i2.hasNext()) {
int cmp = i1.next().compareTo(i2.next());
if (cmp != 0) {
return cmp;
}
}
if (i1.hasNext()) {
return 1;
} else if (i2.hasNext()) {
return -1;
} else {
assert p1.equals(p2);
return 0;
}
};
}

View file

@ -17,6 +17,7 @@ public record PathLookup(
Path homeDir,
Path configDir,
Path[] dataDirs,
Path[] sharedRepoDirs,
Path tempDir,
Function<String, String> settingResolver,
Function<String, Stream<String>> settingGlobResolver

View file

@ -21,6 +21,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;
import static java.lang.Character.isLetter;
/**
* Describes a file entitlement with a path and mode.
*/
@ -36,29 +38,104 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
public enum BaseDir {
CONFIG,
DATA,
SHARED_REPO,
HOME
}
public enum Platform {
LINUX,
MACOS,
WINDOWS;
private static final Platform current = findCurrent();
private static Platform findCurrent() {
String os = System.getProperty("os.name");
if (os.startsWith("Linux")) {
return LINUX;
} else if (os.startsWith("Mac OS")) {
return MACOS;
} else if (os.startsWith("Windows")) {
return WINDOWS;
} else {
throw new AssertionError("Unsupported platform [" + os + "]");
}
}
public boolean isCurrent() {
return this == current;
}
}
public sealed interface FileData {
Stream<Path> resolvePaths(PathLookup pathLookup);
Mode mode();
Platform platform();
FileData withPlatform(Platform platform);
static FileData ofPath(Path path, Mode mode) {
return new AbsolutePathFileData(path, mode);
return new AbsolutePathFileData(path, mode, null);
}
static FileData ofRelativePath(Path relativePath, BaseDir baseDir, Mode mode) {
return new RelativePathFileData(relativePath, baseDir, mode);
return new RelativePathFileData(relativePath, baseDir, mode, null);
}
static FileData ofPathSetting(String setting, Mode mode) {
return new PathSettingFileData(setting, mode);
return new PathSettingFileData(setting, mode, null);
}
static FileData ofRelativePathSetting(String setting, BaseDir baseDir, Mode mode) {
return new RelativePathSettingFileData(setting, baseDir, mode);
return new RelativePathSettingFileData(setting, baseDir, mode, null);
}
/**
* Tests if a path is absolute or relative, taking into consideration both Unix and Windows conventions.
* Note that this leads to a conflict, resolved in favor of Unix rules: `/foo` can be either a Unix absolute path, or a Windows
* relative path with "wrong" directory separator (using non-canonical slash in Windows).
*/
static boolean isAbsolutePath(String path) {
if (path.isEmpty()) {
return false;
}
if (path.charAt(0) == '/') {
// Unix/BSD absolute
return true;
}
return isWindowsAbsolutePath(path);
}
private static boolean isSlash(char c) {
return (c == '\\') || (c == '/');
}
private static boolean isWindowsAbsolutePath(String input) {
// if a prefix is present, we expected (long) UNC or (long) absolute
if (input.startsWith("\\\\?\\")) {
return true;
}
if (input.length() > 1) {
char c0 = input.charAt(0);
char c1 = input.charAt(1);
char c = 0;
int next = 2;
if (isSlash(c0) && isSlash(c1)) {
// Two slashes or more: UNC
return true;
}
if (isLetter(c0) && c1 == ':') {
// A drive: absolute
return true;
}
}
// Otherwise relative
return false;
}
}
@ -75,14 +152,9 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
case CONFIG:
return relativePaths.map(relativePath -> pathLookup.configDir().resolve(relativePath));
case DATA:
// multiple data dirs are a pain...we need the combination of relative paths and data dirs
List<Path> paths = new ArrayList<>();
for (var relativePath : relativePaths.toList()) {
for (var dataDir : pathLookup.dataDirs()) {
paths.add(dataDir.resolve(relativePath));
}
}
return paths.stream();
return relativePathsCombination(pathLookup.dataDirs(), relativePaths);
case SHARED_REPO:
return relativePathsCombination(pathLookup.sharedRepoDirs(), relativePaths);
case HOME:
return relativePaths.map(relativePath -> pathLookup.homeDir().resolve(relativePath));
default:
@ -91,32 +163,81 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
}
}
private record AbsolutePathFileData(Path path, Mode mode) implements FileData {
private static Stream<Path> relativePathsCombination(Path[] baseDirs, Stream<Path> relativePaths) {
// multiple base dirs are a pain...we need the combination of the base dirs and relative paths
List<Path> paths = new ArrayList<>();
for (var relativePath : relativePaths.toList()) {
for (var dataDir : baseDirs) {
paths.add(dataDir.resolve(relativePath));
}
}
return paths.stream();
}
private record AbsolutePathFileData(Path path, Mode mode, Platform platform) implements FileData {
@Override
public Stream<Path> resolvePaths(PathLookup pathLookup) {
return Stream.of(path);
}
@Override
public FileData withPlatform(Platform platform) {
if (platform == platform()) {
return this;
}
return new AbsolutePathFileData(path, mode, platform);
}
}
private record RelativePathFileData(Path relativePath, BaseDir baseDir, Mode mode) implements FileData, RelativeFileData {
private record RelativePathFileData(Path relativePath, BaseDir baseDir, Mode mode, Platform platform)
implements
FileData,
RelativeFileData {
@Override
public Stream<Path> resolveRelativePaths(PathLookup pathLookup) {
return Stream.of(relativePath);
}
@Override
public FileData withPlatform(Platform platform) {
if (platform == platform()) {
return this;
}
return new RelativePathFileData(relativePath, baseDir, mode, platform);
}
}
private record PathSettingFileData(String setting, Mode mode) implements FileData {
private record PathSettingFileData(String setting, Mode mode, Platform platform) implements FileData {
@Override
public Stream<Path> resolvePaths(PathLookup pathLookup) {
return resolvePathSettings(pathLookup, setting);
}
@Override
public FileData withPlatform(Platform platform) {
if (platform == platform()) {
return this;
}
return new PathSettingFileData(setting, mode, platform);
}
}
private record RelativePathSettingFileData(String setting, BaseDir baseDir, Mode mode) implements FileData, RelativeFileData {
private record RelativePathSettingFileData(String setting, BaseDir baseDir, Mode mode, Platform platform)
implements
FileData,
RelativeFileData {
@Override
public Stream<Path> resolveRelativePaths(PathLookup pathLookup) {
return resolvePathSettings(pathLookup, setting);
}
@Override
public FileData withPlatform(Platform platform) {
if (platform == platform()) {
return this;
}
return new RelativePathSettingFileData(setting, baseDir, mode, platform);
}
}
private static Stream<Path> resolvePathSettings(PathLookup pathLookup, String setting) {
@ -137,11 +258,24 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
}
}
private static Platform parsePlatform(String platform) {
if (platform.equals("linux")) {
return Platform.LINUX;
} else if (platform.equals("macos")) {
return Platform.MACOS;
} else if (platform.equals("windows")) {
return Platform.WINDOWS;
} else {
throw new PolicyValidationException("invalid platform: " + platform + ", valid values: [linux, macos, windows]");
}
}
private static BaseDir parseBaseDir(String baseDir) {
return switch (baseDir) {
case "config" -> BaseDir.CONFIG;
case "data" -> BaseDir.DATA;
case "home" -> BaseDir.HOME;
// NOTE: shared_repo is _not_ accessible to policy files, only internally
default -> throw new PolicyValidationException(
"invalid relative directory: " + baseDir + ", valid values: [config, data, home]"
);
@ -163,6 +297,7 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
String pathSetting = file.remove("path_setting");
String relativePathSetting = file.remove("relative_path_setting");
String modeAsString = file.remove("mode");
String platformAsString = file.remove("platform");
if (file.isEmpty() == false) {
throw new PolicyValidationException("unknown key(s) [" + file + "] in a listed file for files entitlement");
@ -179,38 +314,45 @@ public record FilesEntitlement(List<FileData> filesData) implements Entitlement
throw new PolicyValidationException("files entitlement must contain 'mode' for every listed file");
}
Mode mode = parseMode(modeAsString);
Platform platform = null;
if (platformAsString != null) {
platform = parsePlatform(platformAsString);
}
BaseDir baseDir = null;
if (relativeTo != null) {
baseDir = parseBaseDir(relativeTo);
}
final FileData fileData;
if (relativePathAsString != null) {
if (baseDir == null) {
throw new PolicyValidationException("files entitlement with a 'relative_path' must specify 'relative_to'");
}
Path relativePath = Path.of(relativePathAsString);
if (relativePath.isAbsolute()) {
if (FileData.isAbsolutePath(relativePathAsString)) {
throw new PolicyValidationException("'relative_path' [" + relativePathAsString + "] must be relative");
}
filesData.add(FileData.ofRelativePath(relativePath, baseDir, mode));
fileData = FileData.ofRelativePath(relativePath, baseDir, mode);
} else if (pathAsString != null) {
Path path = Path.of(pathAsString);
if (path.isAbsolute() == false) {
if (FileData.isAbsolutePath(pathAsString) == false) {
throw new PolicyValidationException("'path' [" + pathAsString + "] must be absolute");
}
filesData.add(FileData.ofPath(path, mode));
fileData = FileData.ofPath(path, mode);
} else if (pathSetting != null) {
filesData.add(FileData.ofPathSetting(pathSetting, mode));
fileData = FileData.ofPathSetting(pathSetting, mode);
} else if (relativePathSetting != null) {
if (baseDir == null) {
throw new PolicyValidationException("files entitlement with a 'relative_path_setting' must specify 'relative_to'");
}
filesData.add(FileData.ofRelativePathSetting(relativePathSetting, baseDir, mode));
fileData = FileData.ofRelativePathSetting(relativePathSetting, baseDir, mode);
} else {
throw new AssertionError("File entry validation error");
}
filesData.add(fileData.withPlatform(platform));
}
return new FilesEntitlement(filesData);
}

View file

@ -42,6 +42,7 @@ public class FileAccessTreeTests extends ESTestCase {
Path.of("/home"),
Path.of("/config"),
new Path[] { Path.of("/data1"), Path.of("/data2") },
new Path[] { Path.of("/shared1"), Path.of("/shared2") },
Path.of("/tmp"),
setting -> settings.get(setting),
glob -> settings.getGlobValues(glob)
@ -117,6 +118,15 @@ public class FileAccessTreeTests extends ESTestCase {
assertThat(tree.canWrite(path("foo/baz")), is(false));
}
public void testPathAndFileWithSamePrefix() {
var tree = accessTree(entitlement("foo/bar/", "read", "foo/bar.xml", "read"));
assertThat(tree.canRead(path("foo")), is(false));
assertThat(tree.canRead(path("foo/bar")), is(true));
assertThat(tree.canRead(path("foo/bar/baz")), is(true));
assertThat(tree.canRead(path("foo/bar.xml")), is(true));
assertThat(tree.canRead(path("foo/bar.txt")), is(false));
}
public void testReadWithRelativePath() {
for (var dir : List.of("config", "home")) {
var tree = accessTree(entitlement(Map.of("relative_path", "foo", "mode", "read", "relative_to", dir)));
@ -171,10 +181,23 @@ public class FileAccessTreeTests extends ESTestCase {
public void testNormalizePath() {
var tree = accessTree(entitlement("foo/../bar", "read"));
assertThat(tree.canRead(path("foo/../bar")), is(true));
assertThat(tree.canRead(path("foo/../bar/")), is(true));
assertThat(tree.canRead(path("foo")), is(false));
assertThat(tree.canRead(path("")), is(false));
}
public void testNormalizeTrailingSlashes() {
var tree = accessTree(entitlement("/trailing/slash/", "read", "/no/trailing/slash", "read"));
assertThat(tree.canRead(path("/trailing/slash")), is(true));
assertThat(tree.canRead(path("/trailing/slash/")), is(true));
assertThat(tree.canRead(path("/trailing/slash.xml")), is(false));
assertThat(tree.canRead(path("/trailing/slash/file.xml")), is(true));
assertThat(tree.canRead(path("/no/trailing/slash")), is(true));
assertThat(tree.canRead(path("/no/trailing/slash/")), is(true));
assertThat(tree.canRead(path("/no/trailing/slash.xml")), is(false));
assertThat(tree.canRead(path("/no/trailing/slash/file.xml")), is(true));
}
public void testForwardSlashes() {
String sep = getDefaultFileSystem().getSeparator();
var tree = accessTree(entitlement("a/b", "read", "m" + sep + "n", "read"));

View file

@ -69,6 +69,7 @@ public class PolicyManagerTests extends ESTestCase {
TEST_BASE_DIR.resolve("/user/home"),
TEST_BASE_DIR.resolve("/config"),
new Path[] { TEST_BASE_DIR.resolve("/data1/"), TEST_BASE_DIR.resolve("/data2") },
new Path[] { TEST_BASE_DIR.resolve("/shared1"), TEST_BASE_DIR.resolve("/shared2") },
TEST_BASE_DIR.resolve("/temp"),
Settings.EMPTY::get,
Settings.EMPTY::getGlobValues

View file

@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.entitlement.runtime.policy.entitlements;
import org.elasticsearch.test.ESTestCase;
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.FileData.isAbsolutePath;
import static org.hamcrest.Matchers.is;
public class FileDataTests extends ESTestCase {
public void testPathIsAbsolute() {
var windowsNamedPipe = "\\\\.\\pipe";
var windowsDosAbsolutePath = "C:\\temp";
var unixAbsolutePath = "/tmp/foo";
var unixStyleUncPath = "//C/temp";
var uncPath = "\\\\C\\temp";
var longPath = "\\\\?\\C:\\temp";
var relativePath = "foo";
var headingSlashRelativePath = "\\foo";
assertThat(isAbsolutePath(windowsNamedPipe), is(true));
assertThat(isAbsolutePath(windowsDosAbsolutePath), is(true));
assertThat(isAbsolutePath(unixAbsolutePath), is(true));
assertThat(isAbsolutePath(unixStyleUncPath), is(true));
assertThat(isAbsolutePath(uncPath), is(true));
assertThat(isAbsolutePath(longPath), is(true));
assertThat(isAbsolutePath(relativePath), is(false));
assertThat(isAbsolutePath(headingSlashRelativePath), is(false));
assertThat(isAbsolutePath(""), is(false));
}
}

View file

@ -40,6 +40,7 @@ public class FilesEntitlementTests extends ESTestCase {
Path.of("home"),
Path.of("/config"),
new Path[] { Path.of("/data1"), Path.of("/data2") },
new Path[] { Path.of("/shared1"), Path.of("/shared2") },
Path.of("/tmp"),
setting -> settings.get(setting),
glob -> settings.getGlobValues(glob)
@ -60,12 +61,36 @@ public class FilesEntitlementTests extends ESTestCase {
assertThat(ex.getMessage(), is("invalid relative directory: bar, valid values: [config, data, home]"));
}
public void testFileDataRelativeWithEmptyDirectory() {
public void testFileDataRelativeWithAbsoluteDirectoryFails() {
var fileData = FileData.ofRelativePath(Path.of(""), FilesEntitlement.BaseDir.DATA, READ_WRITE);
var dataDirs = fileData.resolvePaths(TEST_PATH_LOOKUP);
assertThat(dataDirs.toList(), contains(Path.of("/data1/"), Path.of("/data2")));
}
public void testFileDataAbsoluteWithRelativeDirectoryFails() {
var ex = expectThrows(
PolicyValidationException.class,
() -> FilesEntitlement.build(List.of((Map.of("path", "foo", "mode", "read"))))
);
assertThat(ex.getMessage(), is("'path' [foo] must be absolute"));
}
public void testFileDataRelativeWithEmptyDirectory() {
var ex = expectThrows(
PolicyValidationException.class,
() -> FilesEntitlement.build(List.of((Map.of("relative_path", "/foo", "mode", "read", "relative_to", "config"))))
);
var ex2 = expectThrows(
PolicyValidationException.class,
() -> FilesEntitlement.build(List.of((Map.of("relative_path", "C:\\foo", "mode", "read", "relative_to", "config"))))
);
assertThat(ex.getMessage(), is("'relative_path' [/foo] must be relative"));
assertThat(ex2.getMessage(), is("'relative_path' [C:\\foo] must be relative"));
}
public void testPathSettingResolve() {
var entitlement = FilesEntitlement.build(List.of(Map.of("path_setting", "foo.bar", "mode", "read")));
var filesData = entitlement.filesData();

View file

@ -21,7 +21,6 @@ import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Priority;
@ -49,7 +48,6 @@ public class PromoteDataStreamTransportAction extends AcknowledgedTransportMaste
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
SystemIndices systemIndices
) {
super(

View file

@ -15,7 +15,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
@ -46,7 +45,6 @@ public class TransportGetDataStreamLifecycleStatsAction extends TransportMasterN
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
DataStreamLifecycleService lifecycleService
) {
super(

View file

@ -17,7 +17,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.DataStreamLifecycle;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
@ -52,7 +51,6 @@ public class TransportGetDataStreamLifecycleStatsActionTests extends ESTestCase
mock(ClusterService.class),
mock(ThreadPool.class),
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
dataStreamLifecycleService
);
private Long lastRunDuration;

View file

@ -18,7 +18,7 @@ dependencies {
javaRestTestImplementation(testArtifact(project(":qa:full-cluster-restart"), "javaRestTest"))
}
buildParams.bwcVersions.withWireCompatible(v -> v.before("9.0.0")) { bwcVersion, baseName ->
buildParams.bwcVersions.withWireCompatible(v -> v.onOrAfter("8.15.0")) { bwcVersion, baseName ->
tasks.register(bwcTaskName(bwcVersion), StandaloneRestIntegTestTask) {
usesBwcDistribution(bwcVersion)
systemProperty("tests.old_cluster_version", bwcVersion)

View file

@ -12,36 +12,25 @@ import fixture.geoip.GeoIpHttpFixture;
import com.carrotsearch.randomizedtesting.annotations.Name;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.WarningsHandler;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.FeatureFlag;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.cluster.util.Version;
import org.elasticsearch.test.rest.ObjectPath;
import org.elasticsearch.upgrades.FullClusterRestartUpgradeStatus;
import org.elasticsearch.upgrades.ParameterizedFullClusterRestartTestCase;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCase {
@ -50,29 +39,16 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
private static final GeoIpHttpFixture fixture = new GeoIpHttpFixture(useFixture);
// e.g. use ./gradlew -Dtests.jvm.argline="-Dgeoip_test_with_security=false" ":modules:ingest-geoip:qa:full-cluster-restart:check"
// to set this to false, if you so desire
private static final boolean useSecurity = Boolean.parseBoolean(System.getProperty("geoip_test_with_security", "true"));
private static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.version(Version.fromString(OLD_CLUSTER_VERSION))
.nodes(2)
.setting("ingest.geoip.downloader.endpoint", () -> fixture.getAddress(), s -> useFixture)
.setting("xpack.security.enabled", useSecurity ? "true" : "false")
.setting("xpack.security.enabled", "false")
// .setting("logger.org.elasticsearch.ingest.geoip", "TRACE")
.feature(FeatureFlag.TIME_SERIES_MODE)
.build();
@Override
protected Settings restClientSettings() {
Settings settings = super.restClientSettings();
if (useSecurity) {
String token = "Basic " + Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8));
settings = Settings.builder().put(settings).put(ThreadContext.PREFIX + ".Authorization", token).build();
}
return settings;
}
@ClassRule
public static TestRule ruleChain = RuleChain.outerRule(fixture).around(cluster);
@ -85,196 +61,32 @@ public class FullClusterRestartIT extends ParameterizedFullClusterRestartTestCas
return cluster;
}
public void testGeoIpSystemFeaturesMigration() throws Exception {
final List<String> maybeSecurityIndex = useSecurity ? List.of(".security-7") : List.of();
final List<String> maybeSecurityIndexReindexed = useSecurity ? List.of(".security-7-reindexed-for-10") : List.of();
@SuppressWarnings("unchecked")
public void testGeoIpDatabaseConfigurations() throws Exception {
if (isRunningAgainstOldCluster()) {
Request enableDownloader = new Request("PUT", "/_cluster/settings");
enableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": true}}
""");
assertOK(client().performRequest(enableDownloader));
Request putPipeline = new Request("PUT", "/_ingest/pipeline/geoip");
putPipeline.setJsonEntity("""
Request putConfiguration = new Request("PUT", "_ingest/ip_location/database/my-database-1");
putConfiguration.setJsonEntity("""
{
"description": "Add geoip info",
"processors": [{
"geoip": {
"field": "ip",
"target_field": "geo",
"database_file": "GeoLite2-Country.mmdb"
}
}]
"name": "GeoIP2-Domain",
"maxmind": {
"account_id": "1234567"
}
}
""");
assertOK(client().performRequest(putPipeline));
// wait for the geo databases to all be loaded
assertBusy(() -> testDatabasesLoaded(), 30, TimeUnit.SECONDS);
// the geoip index should be created
assertBusy(() -> testCatIndices(List.of(".geoip_databases"), maybeSecurityIndex));
assertBusy(() -> testIndexGeoDoc());
// before the upgrade, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndex));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndex));
// and getting data streams
assertBusy(() -> testGetDatastreams());
} else {
// after the upgrade, but before the migration, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndex));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndex));
// and getting data streams
assertBusy(() -> testGetDatastreams());
// migrate the system features and give the cluster a moment to settle
Request migrateSystemFeatures = new Request("POST", "/_migration/system_features");
assertOK(client().performRequest(migrateSystemFeatures));
ensureHealth(request -> request.addParameter("wait_for_status", "yellow"));
assertBusy(() -> testCatIndices(List.of(".geoip_databases-reindexed-for-10", "my-index-00001"), maybeSecurityIndexReindexed));
assertBusy(() -> testIndexGeoDoc());
// after the migration, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndexReindexed));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndexReindexed));
// and getting data streams
assertBusy(() -> testGetDatastreams());
Request disableDownloader = new Request("PUT", "/_cluster/settings");
disableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": false}}
""");
assertOK(client().performRequest(disableDownloader));
// the geoip index should be deleted
assertBusy(() -> testCatIndices(List.of("my-index-00001"), maybeSecurityIndexReindexed));
Request enableDownloader = new Request("PUT", "/_cluster/settings");
enableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": true}}
""");
assertOK(client().performRequest(enableDownloader));
// wait for the geo databases to all be loaded
assertBusy(() -> testDatabasesLoaded(), 30, TimeUnit.SECONDS);
// the geoip index should be recreated
assertBusy(() -> testCatIndices(List.of(".geoip_databases", "my-index-00001"), maybeSecurityIndexReindexed));
assertBusy(() -> testIndexGeoDoc());
}
}
@SuppressWarnings("unchecked")
private void testDatabasesLoaded() throws IOException {
Request getTaskState = new Request("GET", "/_cluster/state");
ObjectPath state = ObjectPath.createFromResponse(assertOK(client().performRequest(getTaskState)));
List<?> tasks = state.evaluate("metadata.persistent_tasks.tasks");
// Short-circuit to avoid using steams if the list is empty
if (tasks.isEmpty()) {
fail();
}
Map<String, Object> databases = (Map<String, Object>) tasks.stream().map(task -> {
try {
return ObjectPath.evaluate(task, "task.geoip-downloader.state.databases");
} catch (IOException e) {
return null;
}
}).filter(Objects::nonNull).findFirst().orElse(null);
assertNotNull(databases);
for (String name : List.of("GeoLite2-ASN.mmdb", "GeoLite2-City.mmdb", "GeoLite2-Country.mmdb")) {
Object database = databases.get(name);
assertNotNull(database);
assertNotNull(ObjectPath.evaluate(database, "md5"));
}
}
private void testCatIndices(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request catIndices = new Request("GET", "_cat/indices/*?s=index&h=index&expand_wildcards=all");
// the cat APIs can sometimes 404, erroneously
// see https://github.com/elastic/elasticsearch/issues/104371
setIgnoredErrorResponseCodes(catIndices, RestStatus.NOT_FOUND);
String response = EntityUtils.toString(assertOK(client().performRequest(catIndices)).getEntity());
List<String> indices = List.of(response.trim().split("\\s+"));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
assertOK(client().performRequest(putConfiguration));
}
assertThat(new HashSet<>(indices), is(new HashSet<>(indexNames)));
}
private void testIndexGeoDoc() throws IOException {
Request putDoc = new Request("PUT", "/my-index-00001/_doc/my_id?pipeline=geoip");
putDoc.setJsonEntity("""
{"ip": "89.160.20.128"}
""");
assertOK(client().performRequest(putDoc));
Request getDoc = new Request("GET", "/my-index-00001/_doc/my_id");
ObjectPath doc = ObjectPath.createFromResponse(assertOK(client().performRequest(getDoc)));
assertNull(doc.evaluate("_source.tags"));
assertEquals("Sweden", doc.evaluate("_source.geo.country_name"));
}
private void testGetStar(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request getStar = new Request("GET", "*?expand_wildcards=all");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = assertOK(client().performRequest(getStar));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
}
Map<String, Object> map = responseAsMap(response);
assertThat(map.keySet(), is(new HashSet<>(indexNames)));
}
private void testGetStarAsKibana(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request getStar = new Request("GET", "*?expand_wildcards=all");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder()
.addHeader("X-elastic-product-origin", "kibana")
.setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = assertOK(client().performRequest(getStar));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
}
Map<String, Object> map = responseAsMap(response);
assertThat(map.keySet(), is(new HashSet<>(indexNames)));
}
private void testGetDatastreams() throws IOException {
Request getStar = new Request("GET", "_data_stream");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = client().performRequest(getStar);
assertOK(response);
// note: we don't actually care about the response, just that there was one and that it didn't error out on us
assertBusy(() -> {
Request getConfiguration = new Request("GET", "_ingest/ip_location/database/my-database-1");
Response response = assertOK(client().performRequest(getConfiguration));
Map<String, Object> map = responseAsMap(response);
assertThat(map.keySet(), equalTo(Set.of("databases")));
List<Map<String, Object>> databases = (List<Map<String, Object>>) map.get("databases");
assertThat(databases, hasSize(1));
Map<String, Object> database = databases.get(0);
assertThat(database.get("id"), is("my-database-1"));
assertThat(database.get("version"), is(1));
assertThat(database.get("database"), equalTo(Map.of("name", "GeoIP2-Domain", "maxmind", Map.of("account_id", "1234567"))));
}, 30, TimeUnit.SECONDS);
}
}

View file

@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.bwc-test'
dependencies {
javaRestTestImplementation project(':test:fixtures:geoip-fixture')
javaRestTestImplementation(testArtifact(project(":qa:full-cluster-restart"), "javaRestTest"))
}
buildParams.bwcVersions.withWireCompatible(v -> v.before("9.0.0")) { bwcVersion, baseName ->
tasks.register(bwcTaskName(bwcVersion), StandaloneRestIntegTestTask) {
usesBwcDistribution(bwcVersion)
systemProperty("tests.old_cluster_version", bwcVersion)
}
}

View file

@ -0,0 +1,280 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.ingest.geoip;
import fixture.geoip.GeoIpHttpFixture;
import com.carrotsearch.randomizedtesting.annotations.Name;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.WarningsHandler;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.FeatureFlag;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.cluster.util.Version;
import org.elasticsearch.test.rest.ObjectPath;
import org.elasticsearch.upgrades.FullClusterRestartUpgradeStatus;
import org.elasticsearch.upgrades.ParameterizedFullClusterRestartTestCase;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.Matchers.is;
public class GeoIpReindexedIT extends ParameterizedFullClusterRestartTestCase {
private static final boolean useFixture = Boolean.getBoolean("geoip_use_service") == false;
private static final GeoIpHttpFixture fixture = new GeoIpHttpFixture(useFixture);
// e.g. use ./gradlew -Dtests.jvm.argline="-Dgeoip_test_with_security=false" ":modules:ingest-geoip:qa:full-cluster-restart:check"
// to set this to false, if you so desire
private static final boolean useSecurity = Boolean.parseBoolean(System.getProperty("geoip_test_with_security", "true"));
private static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.version(Version.fromString(OLD_CLUSTER_VERSION))
.nodes(2)
.setting("ingest.geoip.downloader.endpoint", () -> fixture.getAddress(), s -> useFixture)
.setting("xpack.security.enabled", useSecurity ? "true" : "false")
.feature(FeatureFlag.TIME_SERIES_MODE)
.build();
@Override
protected Settings restClientSettings() {
Settings settings = super.restClientSettings();
if (useSecurity) {
String token = "Basic " + Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8));
settings = Settings.builder().put(settings).put(ThreadContext.PREFIX + ".Authorization", token).build();
}
return settings;
}
@ClassRule
public static TestRule ruleChain = RuleChain.outerRule(fixture).around(cluster);
public GeoIpReindexedIT(@Name("cluster") FullClusterRestartUpgradeStatus upgradeStatus) {
super(upgradeStatus);
}
@Override
protected ElasticsearchCluster getUpgradeCluster() {
return cluster;
}
public void testGeoIpSystemFeaturesMigration() throws Exception {
final List<String> maybeSecurityIndex = useSecurity ? List.of(".security-7") : List.of();
final List<String> maybeSecurityIndexReindexed = useSecurity ? List.of(".security-7-reindexed-for-10") : List.of();
if (isRunningAgainstOldCluster()) {
Request enableDownloader = new Request("PUT", "/_cluster/settings");
enableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": true}}
""");
assertOK(client().performRequest(enableDownloader));
Request putPipeline = new Request("PUT", "/_ingest/pipeline/geoip");
putPipeline.setJsonEntity("""
{
"description": "Add geoip info",
"processors": [{
"geoip": {
"field": "ip",
"target_field": "geo",
"database_file": "GeoLite2-Country.mmdb"
}
}]
}
""");
assertOK(client().performRequest(putPipeline));
// wait for the geo databases to all be loaded
assertBusy(() -> testDatabasesLoaded(), 30, TimeUnit.SECONDS);
// the geoip index should be created
assertBusy(() -> testCatIndices(List.of(".geoip_databases"), maybeSecurityIndex));
assertBusy(() -> testIndexGeoDoc());
// before the upgrade, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndex));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndex));
// and getting data streams
assertBusy(() -> testGetDatastreams());
} else {
// after the upgrade, but before the migration, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndex));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndex));
// and getting data streams
assertBusy(() -> testGetDatastreams());
// migrate the system features and give the cluster a moment to settle
Request migrateSystemFeatures = new Request("POST", "/_migration/system_features");
assertOK(client().performRequest(migrateSystemFeatures));
ensureHealth(request -> request.addParameter("wait_for_status", "yellow"));
assertBusy(() -> testCatIndices(List.of(".geoip_databases-reindexed-for-10", "my-index-00001"), maybeSecurityIndexReindexed));
assertBusy(() -> testIndexGeoDoc());
// after the migration, Kibana should work
assertBusy(() -> testGetStarAsKibana(List.of("my-index-00001"), maybeSecurityIndexReindexed));
// as should a normal get *
assertBusy(() -> testGetStar(List.of("my-index-00001"), maybeSecurityIndexReindexed));
// and getting data streams
assertBusy(() -> testGetDatastreams());
Request disableDownloader = new Request("PUT", "/_cluster/settings");
disableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": false}}
""");
assertOK(client().performRequest(disableDownloader));
// the geoip index should be deleted
assertBusy(() -> testCatIndices(List.of("my-index-00001"), maybeSecurityIndexReindexed));
Request enableDownloader = new Request("PUT", "/_cluster/settings");
enableDownloader.setJsonEntity("""
{"persistent": {"ingest.geoip.downloader.enabled": true}}
""");
assertOK(client().performRequest(enableDownloader));
// wait for the geo databases to all be loaded
assertBusy(() -> testDatabasesLoaded(), 30, TimeUnit.SECONDS);
// the geoip index should be recreated
assertBusy(() -> testCatIndices(List.of(".geoip_databases", "my-index-00001"), maybeSecurityIndexReindexed));
assertBusy(() -> testIndexGeoDoc());
}
}
@SuppressWarnings("unchecked")
private void testDatabasesLoaded() throws IOException {
Request getTaskState = new Request("GET", "/_cluster/state");
ObjectPath state = ObjectPath.createFromResponse(assertOK(client().performRequest(getTaskState)));
List<?> tasks = state.evaluate("metadata.persistent_tasks.tasks");
// Short-circuit to avoid using steams if the list is empty
if (tasks.isEmpty()) {
fail();
}
Map<String, Object> databases = (Map<String, Object>) tasks.stream().map(task -> {
try {
return ObjectPath.evaluate(task, "task.geoip-downloader.state.databases");
} catch (IOException e) {
return null;
}
}).filter(Objects::nonNull).findFirst().orElse(null);
assertNotNull(databases);
for (String name : List.of("GeoLite2-ASN.mmdb", "GeoLite2-City.mmdb", "GeoLite2-Country.mmdb")) {
Object database = databases.get(name);
assertNotNull(database);
assertNotNull(ObjectPath.evaluate(database, "md5"));
}
}
private void testCatIndices(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request catIndices = new Request("GET", "_cat/indices/*?s=index&h=index&expand_wildcards=all");
// the cat APIs can sometimes 404, erroneously
// see https://github.com/elastic/elasticsearch/issues/104371
setIgnoredErrorResponseCodes(catIndices, RestStatus.NOT_FOUND);
String response = EntityUtils.toString(assertOK(client().performRequest(catIndices)).getEntity());
List<String> indices = List.of(response.trim().split("\\s+"));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
}
assertThat(new HashSet<>(indices), is(new HashSet<>(indexNames)));
}
private void testIndexGeoDoc() throws IOException {
Request putDoc = new Request("PUT", "/my-index-00001/_doc/my_id?pipeline=geoip");
putDoc.setJsonEntity("""
{"ip": "89.160.20.128"}
""");
assertOK(client().performRequest(putDoc));
Request getDoc = new Request("GET", "/my-index-00001/_doc/my_id");
ObjectPath doc = ObjectPath.createFromResponse(assertOK(client().performRequest(getDoc)));
assertNull(doc.evaluate("_source.tags"));
assertEquals("Sweden", doc.evaluate("_source.geo.country_name"));
}
private void testGetStar(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request getStar = new Request("GET", "*?expand_wildcards=all");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = assertOK(client().performRequest(getStar));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
}
Map<String, Object> map = responseAsMap(response);
assertThat(map.keySet(), is(new HashSet<>(indexNames)));
}
private void testGetStarAsKibana(List<String> indexNames, @Nullable List<String> additionalIndexNames) throws IOException {
Request getStar = new Request("GET", "*?expand_wildcards=all");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder()
.addHeader("X-elastic-product-origin", "kibana")
.setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = assertOK(client().performRequest(getStar));
if (additionalIndexNames != null && additionalIndexNames.isEmpty() == false) {
indexNames = new ArrayList<>(indexNames); // recopy into a mutable list
indexNames.addAll(additionalIndexNames);
}
Map<String, Object> map = responseAsMap(response);
assertThat(map.keySet(), is(new HashSet<>(indexNames)));
}
private void testGetDatastreams() throws IOException {
Request getStar = new Request("GET", "_data_stream");
getStar.setOptions(
RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE) // we don't care about warnings, just errors
);
Response response = client().performRequest(getStar);
assertOK(response);
// note: we don't actually care about the response, just that there was one and that it didn't error out on us
}
}

View file

@ -45,7 +45,7 @@ public final class IngestGeoIpMetadata implements Metadata.ProjectCustom {
@SuppressWarnings("unchecked")
private static final ConstructingObjectParser<IngestGeoIpMetadata, Void> PARSER = new ConstructingObjectParser<>(
"ingest_geoip_metadata",
TYPE,
a -> new IngestGeoIpMetadata(
((List<DatabaseConfigurationMetadata>) a[0]).stream().collect(Collectors.toMap((m) -> m.database().id(), Function.identity()))
)

View file

@ -214,6 +214,11 @@ public class IngestGeoIpPlugin extends Plugin
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
return List.of(
new NamedXContentRegistry.Entry(
Metadata.ProjectCustom.class,
new ParseField(IngestGeoIpMetadata.TYPE),
IngestGeoIpMetadata::fromXContent
),
new NamedXContentRegistry.Entry(PersistentTaskParams.class, new ParseField(GEOIP_DOWNLOADER), GeoIpTaskParams::fromXContent),
new NamedXContentRegistry.Entry(PersistentTaskState.class, new ParseField(GEOIP_DOWNLOADER), GeoIpTaskState::fromXContent),
new NamedXContentRegistry.Entry(

View file

@ -21,7 +21,6 @@ import org.elasticsearch.cluster.ClusterStateTaskListener;
import org.elasticsearch.cluster.SimpleBatchedExecutor;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.cluster.service.MasterServiceTaskQueue;
@ -63,8 +62,7 @@ public class TransportDeleteDatabaseConfigurationAction extends TransportMasterN
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
DeleteDatabaseConfigurationAction.NAME,

View file

@ -20,7 +20,6 @@ import org.elasticsearch.cluster.ClusterStateTaskListener;
import org.elasticsearch.cluster.SimpleBatchedExecutor;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.cluster.service.MasterServiceTaskQueue;
@ -65,8 +64,7 @@ public class TransportPutDatabaseConfigurationAction extends TransportMasterNode
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
PutDatabaseConfigurationAction.NAME,

View file

@ -214,3 +214,62 @@
index.mode: lookup
index.number_of_shards: 2
---
"Create index with invalid field type":
- requires:
cluster_features: [ "mapper.unknown_field_mapping_update_error_message" ]
reason: "Update error message for unknown field type"
- do:
catch: bad_request
indices.create:
index: test_index
body:
mappings:
properties:
content:
type: invalid
- match: { error.type: "mapper_parsing_exception" }
- match: { error.reason: "Failed to parse mapping: The mapper type [invalid] declared on field [content] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation." }
---
"Create index with invalid runtime field type":
- requires:
cluster_features: [ "mapper.unknown_field_mapping_update_error_message" ]
reason: "Update error message for unknown field type"
- do:
catch: bad_request
indices.create:
index: test_index
body:
mappings:
runtime:
content:
type: invalid
- match: { error.type: "mapper_parsing_exception" }
- match: { error.reason: "Failed to parse mapping: The mapper type [invalid] declared on runtime field [content] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation." }
---
"Create index with invalid multi-field type":
- requires:
cluster_features: [ "mapper.unknown_field_mapping_update_error_message" ]
reason: "Update error message for unknown field type"
- do:
catch: bad_request
indices.create:
index: test_index
body:
mappings:
properties:
city:
type: text
fields:
raw:
type: invalid
- match: { error.type: "mapper_parsing_exception" }
- match: { error.reason: "Failed to parse mapping: The mapper type [invalid] declared on field [raw] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation." }

View file

@ -20,7 +20,6 @@ import org.elasticsearch.cluster.ClusterInfoService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.metadata.ProjectMetadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
@ -67,7 +66,6 @@ public class TransportClusterAllocationExplainAction extends TransportMasterNode
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ClusterInfoService clusterInfoService,
SnapshotsInfoService snapshotsInfoService,
AllocationDeciders allocationDeciders,

View file

@ -20,7 +20,6 @@ import org.elasticsearch.cluster.ClusterStateTaskExecutor;
import org.elasticsearch.cluster.ClusterStateTaskListener;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.cluster.routing.allocation.allocator.AllocationActionMultiListener;
import org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceShardsAllocator;
@ -46,7 +45,6 @@ public class TransportDeleteDesiredBalanceAction extends TransportMasterNodeActi
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
AllocationService allocationService,
ShardsAllocator shardsAllocator
) {

View file

@ -24,7 +24,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.allocation.AllocationStatsService;
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
import org.elasticsearch.cluster.routing.allocation.NodeAllocationStats;
@ -59,7 +58,6 @@ public class TransportGetAllocationStatsAction extends TransportMasterNodeReadAc
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
AllocationStatsService allocationStatsService
) {
super(

View file

@ -18,7 +18,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.IndexRoutingTable;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.ShardRouting;
@ -56,7 +55,6 @@ public class TransportGetDesiredBalanceAction extends TransportMasterNodeReadAct
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ShardsAllocator shardsAllocator,
ClusterInfoService clusterInfoService,
WriteLoadForecaster writeLoadForecaster

View file

@ -26,7 +26,6 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.coordination.CoordinationMetadata;
import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion;
import org.elasticsearch.cluster.coordination.Reconfigurator;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Priority;
@ -72,7 +71,6 @@ public class TransportAddVotingConfigExclusionsAction extends TransportMasterNod
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Reconfigurator reconfigurator
) {
super(

View file

@ -26,7 +26,6 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.coordination.CoordinationMetadata;
import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion;
import org.elasticsearch.cluster.coordination.Reconfigurator;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Priority;
@ -54,7 +53,6 @@ public class TransportClearVotingConfigExclusionsAction extends TransportMasterN
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Reconfigurator reconfigurator
) {
super(

View file

@ -21,7 +21,6 @@ import org.elasticsearch.cluster.SimpleBatchedExecutor;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.DesiredNodesMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.cluster.service.MasterServiceTaskQueue;
import org.elasticsearch.common.Priority;
@ -46,8 +45,7 @@ public class TransportDeleteDesiredNodesAction extends TransportMasterNodeAction
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -17,7 +17,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.DesiredNodes;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -33,8 +32,7 @@ public class TransportGetDesiredNodesAction extends TransportMasterNodeReadActio
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
GetDesiredNodesAction.NAME,

View file

@ -16,7 +16,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.UpdateForV10;
@ -67,7 +66,6 @@ public class TransportGetFeatureUpgradeStatusAction extends TransportMasterNodeA
ThreadPool threadPool,
ActionFilters actionFilters,
ClusterService clusterService,
IndexNameExpressionResolver indexNameExpressionResolver,
SystemIndices systemIndices
) {
super(

View file

@ -18,7 +18,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.TimeValue;
@ -53,7 +52,6 @@ public class TransportPostFeatureUpgradeAction extends TransportMasterNodeAction
ThreadPool threadPool,
ActionFilters actionFilters,
ClusterService clusterService,
IndexNameExpressionResolver indexNameExpressionResolver,
SystemIndices systemIndices,
PersistentTasksService persistentTasksService
) {

View file

@ -19,7 +19,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.cluster.health.ClusterStateHealth;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
@ -64,7 +63,6 @@ public class TransportPrevalidateNodeRemovalAction extends TransportMasterNodeRe
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
NodeClient client,
ProjectResolver projectResolver
) {

View file

@ -21,7 +21,6 @@ import org.elasticsearch.cluster.SnapshotDeletionsInProgress;
import org.elasticsearch.cluster.SnapshotsInProgress;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.blobstore.DeleteResult;
@ -72,8 +71,7 @@ public final class TransportCleanupRepositoryAction extends TransportMasterNodeA
ClusterService clusterService,
RepositoriesService repositoriesService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -18,7 +18,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -44,8 +43,7 @@ public class TransportDeleteRepositoryAction extends AcknowledgedTransportMaster
ClusterService clusterService,
RepositoriesService repositoriesService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -15,7 +15,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.RepositoriesMetadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
@ -36,8 +35,7 @@ public class TransportGetRepositoriesAction extends TransportMasterNodeReadActio
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
GetRepositoriesAction.NAME,

View file

@ -18,7 +18,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -44,8 +43,7 @@ public class TransportPutRepositoryAction extends AcknowledgedTransportMasterNod
ClusterService clusterService,
RepositoriesService repositoriesService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -15,7 +15,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
@ -38,8 +37,7 @@ public class TransportVerifyRepositoryAction extends TransportMasterNodeAction<V
ClusterService clusterService,
RepositoriesService repositoriesService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
VerifyRepositoryAction.NAME,

View file

@ -25,7 +25,6 @@ import org.elasticsearch.cluster.ClusterStateAckListener;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.project.ProjectResolver;
@ -69,7 +68,6 @@ public class TransportClusterRerouteAction extends TransportMasterNodeAction<Clu
ThreadPool threadPool,
AllocationService allocationService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver
) {
super(

View file

@ -21,7 +21,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.routing.RerouteService;
import org.elasticsearch.cluster.service.ClusterService;
@ -60,7 +59,6 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeAct
RerouteService rerouteService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ClusterSettings clusterSettings
) {
super(

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -40,8 +39,7 @@ public final class TransportCloneSnapshotAction extends AcknowledgedTransportMas
ClusterService clusterService,
ThreadPool threadPool,
SnapshotsService snapshotsService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -16,7 +16,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -39,8 +38,7 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeAction<Cre
ClusterService clusterService,
ThreadPool threadPool,
SnapshotsService snapshotsService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -18,7 +18,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -40,8 +39,7 @@ public class TransportDeleteSnapshotAction extends AcknowledgedTransportMasterNo
ClusterService clusterService,
ThreadPool threadPool,
SnapshotsService snapshotsService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -15,7 +15,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.indices.SystemIndices;
@ -36,7 +35,6 @@ public class TransportSnapshottableFeaturesAction extends TransportMasterNodeAct
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
SystemIndices systemIndices
) {
super(

View file

@ -19,7 +19,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.SnapshotsInProgress;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.RepositoryMetadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
@ -113,8 +112,7 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeAction<GetSn
ClusterService clusterService,
ThreadPool threadPool,
RepositoriesService repositoriesService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -16,7 +16,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.RepositoriesMetadata;
import org.elasticsearch.cluster.metadata.RepositoryMetadata;
import org.elasticsearch.cluster.service.ClusterService;
@ -50,8 +49,7 @@ public class TransportGetShardSnapshotAction extends TransportMasterNodeAction<G
ClusterService clusterService,
ThreadPool threadPool,
RepositoriesService repositoriesService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -16,7 +16,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.snapshots.RestoreService;
@ -37,8 +36,7 @@ public class TransportRestoreSnapshotAction extends TransportMasterNodeAction<Re
ClusterService clusterService,
ThreadPool threadPool,
RestoreService restoreService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -22,7 +22,6 @@ import org.elasticsearch.cluster.SnapshotsInProgress;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.util.CollectionUtils;
@ -81,8 +80,7 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<Sn
ThreadPool threadPool,
RepositoriesService repositoriesService,
NodeClient client,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -35,8 +34,7 @@ public class TransportDeleteStoredScriptAction extends AcknowledgedTransportMast
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -15,7 +15,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -31,8 +30,7 @@ public class TransportGetStoredScriptAction extends TransportMasterNodeReadActio
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
GetStoredScriptAction.NAME,

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -37,7 +36,6 @@ public class TransportPutStoredScriptAction extends AcknowledgedTransportMasterN
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ScriptService scriptService
) {
super(

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.cluster.service.PendingClusterTask;
import org.elasticsearch.common.util.concurrent.EsExecutors;
@ -40,8 +39,7 @@ public class TransportPendingClusterTasksAction extends TransportMasterNodeReadA
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
TYPE.name(),

View file

@ -92,7 +92,6 @@ public final class AutoCreateAction extends ActionType<CreateIndexResponse> {
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
MetadataCreateIndexService createIndexService,
MetadataCreateDataStreamService metadataCreateDataStreamService,
AutoCreateIndex autoCreateIndex,

View file

@ -29,7 +29,6 @@ import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.metadata.IndexGraveyard;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
@ -62,7 +61,6 @@ public class TransportDeleteDanglingIndexAction extends AcknowledgedTransportMas
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Settings settings,
NodeClient nodeClient
) {

View file

@ -59,21 +59,10 @@ public class TransportResizeAction extends TransportMasterNodeAction<ResizeReque
ThreadPool threadPool,
MetadataCreateIndexService createIndexService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver,
Client client
) {
this(
ResizeAction.NAME,
transportService,
clusterService,
threadPool,
createIndexService,
actionFilters,
indexNameExpressionResolver,
projectResolver,
client
);
this(ResizeAction.NAME, transportService, clusterService, threadPool, createIndexService, actionFilters, projectResolver, client);
}
protected TransportResizeAction(
@ -83,7 +72,6 @@ public class TransportResizeAction extends TransportMasterNodeAction<ResizeReque
ThreadPool threadPool,
MetadataCreateIndexService createIndexService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver,
Client client
) {

View file

@ -20,7 +20,6 @@ import org.elasticsearch.action.support.master.MasterNodeRequest;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.project.ProjectResolver;
import org.elasticsearch.cluster.service.ClusterService;
@ -57,7 +56,6 @@ public class TransportDeleteComponentTemplateAction extends AcknowledgedTranspor
ThreadPool threadPool,
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver
) {
super(TYPE.name(), transportService, clusterService, threadPool, actionFilters, Request::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);

View file

@ -20,7 +20,6 @@ import org.elasticsearch.action.support.master.MasterNodeRequest;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.project.ProjectResolver;
import org.elasticsearch.cluster.service.ClusterService;
@ -56,7 +55,6 @@ public class TransportDeleteComposableIndexTemplateAction extends AcknowledgedTr
ThreadPool threadPool,
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver
) {
super(TYPE.name(), transportService, clusterService, threadPool, actionFilters, Request::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);

View file

@ -18,7 +18,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.project.ProjectResolver;
import org.elasticsearch.cluster.service.ClusterService;
@ -46,8 +45,7 @@ public class TransportDeleteIndexTemplateAction extends AcknowledgedTransportMas
ThreadPool threadPool,
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
ProjectResolver projectResolver,
IndexNameExpressionResolver indexNameExpressionResolver
ProjectResolver projectResolver
) {
super(
TYPE.name(),

View file

@ -19,7 +19,6 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.ComponentTemplate;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.metadata.Template;
import org.elasticsearch.cluster.project.ProjectResolver;
@ -49,7 +48,6 @@ public class TransportPutComponentTemplateAction extends AcknowledgedTransportMa
ThreadPool threadPool,
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
IndexScopedSettings indexScopedSettings,
ProjectResolver projectResolver
) {

View file

@ -24,7 +24,6 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.metadata.ReservedStateMetadata;
@ -67,7 +66,6 @@ public class TransportPutComposableIndexTemplateAction extends AcknowledgedTrans
ThreadPool threadPool,
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
ProjectResolver projectResolver
) {
super(TYPE.name(), transportService, clusterService, threadPool, actionFilters, Request::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);

View file

@ -19,7 +19,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
import org.elasticsearch.cluster.project.ProjectResolver;
import org.elasticsearch.cluster.service.ClusterService;
@ -54,7 +53,6 @@ public class TransportPutIndexTemplateAction extends AcknowledgedTransportMaster
MetadataIndexTemplateService indexTemplateService,
ActionFilters actionFilters,
ProjectResolver projectResolver,
IndexNameExpressionResolver indexNameExpressionResolver,
IndexScopedSettings indexScopedSettings
) {
super(

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAc
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.project.ProjectResolver;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.ingest.IngestService;
@ -41,8 +40,7 @@ public class DeletePipelineTransportAction extends AcknowledgedTransportMasterNo
IngestService ingestService,
TransportService transportService,
ActionFilters actionFilters,
ProjectResolver projectResolver,
IndexNameExpressionResolver indexNameExpressionResolver
ProjectResolver projectResolver
) {
super(
TYPE.name(),

View file

@ -247,8 +247,8 @@ class Elasticsearch {
pluginsResolver::resolveClassToPluginName,
nodeEnv.settings()::get,
nodeEnv.settings()::getGlobValues,
nodeEnv::resolveRepoDir,
nodeEnv.dataDirs(),
nodeEnv.repoDirs(),
nodeEnv.configDir(),
nodeEnv.libDir(),
nodeEnv.logsDir(),

View file

@ -335,7 +335,7 @@ public class Environment {
*/
public static void assertEquivalent(Environment actual, Environment expected) {
assertEquals(actual.dataDirs(), expected.dataDirs(), "dataDirs");
assertEquals(actual.repoDirs(), expected.repoDirs(), "repoDirs");
assertEquals(actual.repoDirs(), expected.repoDirs(), "sharedRepoDirs");
assertEquals(actual.configDir(), expected.configDir(), "configDir");
assertEquals(actual.pluginsDir(), expected.pluginsDir(), "pluginsDir");
assertEquals(actual.binDir(), expected.binDir(), "binDir");

View file

@ -33,6 +33,9 @@ public class MapperFeatures implements FeatureSpecification {
public static final NodeFeature SORT_FIELDS_CHECK_FOR_NESTED_OBJECT_FIX = new NodeFeature("mapper.nested.sorting_fields_check_fix");
public static final NodeFeature DYNAMIC_HANDLING_IN_COPY_TO = new NodeFeature("mapper.copy_to.dynamic_handling");
public static final NodeFeature DOC_VALUES_SKIPPER = new NodeFeature("mapper.doc_values_skipper");
static final NodeFeature UKNOWN_FIELD_MAPPING_UPDATE_ERROR_MESSAGE = new NodeFeature(
"mapper.unknown_field_mapping_update_error_message"
);
@Override
public Set<NodeFeature> getTestFeatures() {
@ -54,6 +57,7 @@ public class MapperFeatures implements FeatureSpecification {
TSDB_NESTED_FIELD_SUPPORT,
SourceFieldMapper.SYNTHETIC_RECOVERY_SOURCE,
ObjectMapper.SUBOBJECTS_FALSE_MAPPING_UPDATE_FIX,
UKNOWN_FIELD_MAPPING_UPDATE_ERROR_MESSAGE,
DOC_VALUES_SKIPPER
);
}

View file

@ -396,7 +396,15 @@ public class ObjectMapper extends Mapper {
}
Mapper.TypeParser typeParser = parserContext.typeParser(type);
if (typeParser == null) {
throw new MapperParsingException("No handler for type [" + type + "] declared on field [" + fieldName + "]");
throw new MapperParsingException(
"The mapper type ["
+ type
+ "] declared on field ["
+ fieldName
+ "] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed."
+ " Check the documentation."
);
}
Mapper.Builder fieldBuilder;
if (objBuilder.subobjects.isPresent() && objBuilder.subobjects.get() != Subobjects.ENABLED) {

View file

@ -179,7 +179,15 @@ public interface RuntimeField extends ToXContentFragment {
}
Parser typeParser = parserContext.runtimeFieldParser(type);
if (typeParser == null) {
throw new MapperParsingException("No handler for type [" + type + "] declared on runtime field [" + fieldName + "]");
throw new MapperParsingException(
"The mapper type ["
+ type
+ "] declared on runtime field ["
+ fieldName
+ "] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed."
+ " Check the documentation."
);
}
runtimeFields.put(fieldName, builder.apply(typeParser.parse(fieldName, propNode, parserContext)));
propNode.remove("type");

View file

@ -161,7 +161,15 @@ public class TypeParsers {
Mapper.TypeParser typeParser = parserContext.typeParser(type);
if (typeParser == null) {
throw new MapperParsingException("no handler for type [" + type + "] declared on field [" + multiFieldName + "]");
throw new MapperParsingException(
"The mapper type ["
+ type
+ "] declared on field ["
+ multiFieldName
+ "] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed."
+ " Check the documentation."
);
}
if (typeParser instanceof FieldMapper.TypeParser == false) {
throw new MapperParsingException("Type [" + type + "] cannot be used in multi field");

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -116,8 +115,7 @@ public class CompletionPersistentTaskAction {
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
PersistentTasksClusterService persistentTasksClusterService,
IndexNameExpressionResolver indexNameExpressionResolver
PersistentTasksClusterService persistentTasksClusterService
) {
super(
INSTANCE.name(),

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -85,8 +84,7 @@ public class RemovePersistentTaskAction {
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
PersistentTasksClusterService persistentTasksClusterService,
IndexNameExpressionResolver indexNameExpressionResolver
PersistentTasksClusterService persistentTasksClusterService
) {
super(
INSTANCE.name(),

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -128,8 +127,7 @@ public class StartPersistentTaskAction {
ActionFilters actionFilters,
PersistentTasksClusterService persistentTasksClusterService,
PersistentTasksExecutorRegistry persistentTasksExecutorRegistry,
PersistentTasksService persistentTasksService,
IndexNameExpressionResolver indexNameExpressionResolver
PersistentTasksService persistentTasksService
) {
super(
INSTANCE.name(),

View file

@ -17,7 +17,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -115,8 +114,7 @@ public class UpdatePersistentTaskStatusAction {
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
PersistentTasksClusterService persistentTasksClusterService,
IndexNameExpressionResolver indexNameExpressionResolver
PersistentTasksClusterService persistentTasksClusterService
) {
super(
INSTANCE.name(),

View file

@ -231,13 +231,7 @@ public final class SnapshotsService extends AbstractLifecycleComponent implement
this.transportService = transportService;
// The constructor of UpdateSnapshotStatusAction will register itself to the TransportService.
this.updateSnapshotStatusHandler = new UpdateSnapshotStatusAction(
transportService,
clusterService,
threadPool,
actionFilters,
indexNameExpressionResolver
);
this.updateSnapshotStatusHandler = new UpdateSnapshotStatusAction(transportService, clusterService, threadPool, actionFilters);
if (DiscoveryNode.isMasterNode(settings)) {
// addLowPriorityApplier to make sure that Repository will be created before snapshot
clusterService.addLowPriorityApplier(this);
@ -3662,8 +3656,7 @@ public final class SnapshotsService extends AbstractLifecycleComponent implement
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
ActionFilters actionFilters
) {
super(
UPDATE_SNAPSHOT_STATUS_ACTION_NAME,

View file

@ -54,7 +54,6 @@ public class TransportClusterAllocationExplainActionTests extends ESTestCase {
clusterService,
threadPool,
new ActionFilters(Set.of()),
null,
() -> ClusterInfo.EMPTY,
EmptySnapshotsInfoService.INSTANCE,
new AllocationDeciders(List.of()),

View file

@ -20,7 +20,6 @@ import org.elasticsearch.cluster.ESAllocationTestCase;
import org.elasticsearch.cluster.EmptyClusterInfoService;
import org.elasticsearch.cluster.TestShardRoutingRoleStrategies;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
@ -74,7 +73,6 @@ public class TransportDeleteDesiredBalanceActionTests extends ESAllocationTestCa
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
mock(AllocationService.class),
mock(ShardsAllocator.class)
).masterOperation(mock(Task.class), new DesiredBalanceRequest(TEST_REQUEST_TIMEOUT), ClusterState.EMPTY_STATE, listener);
@ -149,7 +147,6 @@ public class TransportDeleteDesiredBalanceActionTests extends ESAllocationTestCa
clusterService,
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
allocationService,
allocator
);

View file

@ -73,7 +73,6 @@ public class TransportGetAllocationStatsActionTests extends ESTestCase {
clusterService,
threadPool,
new ActionFilters(Set.of()),
null,
allocationStatsService
);
}

View file

@ -18,7 +18,6 @@ import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ESAllocationTestCase;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
import org.elasticsearch.cluster.node.DiscoveryNodes;
@ -80,7 +79,6 @@ public class TransportGetDesiredBalanceActionTests extends ESAllocationTestCase
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
desiredBalanceShardsAllocator,
clusterInfoService,
TEST_WRITE_LOAD_FORECASTER
@ -112,7 +110,6 @@ public class TransportGetDesiredBalanceActionTests extends ESAllocationTestCase
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
mock(ShardsAllocator.class),
mock(ClusterInfoService.class),
mock(WriteLoadForecaster.class)

View file

@ -34,7 +34,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.indices.TestIndexNameExpressionResolver;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.transport.MockTransport;
import org.elasticsearch.threadpool.TestThreadPool;
@ -133,7 +132,6 @@ public class TransportAddVotingConfigExclusionsActionTests extends ESTestCase {
clusterService,
threadPool,
new ActionFilters(emptySet()),
TestIndexNameExpressionResolver.newInstance(threadPool.getThreadContext()),
reconfigurator
); // registers action

View file

@ -24,7 +24,6 @@ import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.indices.TestIndexNameExpressionResolver;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.transport.MockTransport;
import org.elasticsearch.threadpool.TestThreadPool;
@ -94,7 +93,6 @@ public class TransportClearVotingConfigExclusionsActionTests extends ESTestCase
clusterService,
threadPool,
new ActionFilters(emptySet()),
TestIndexNameExpressionResolver.newInstance(threadPool.getThreadContext()),
reconfigurator
); // registers action

View file

@ -14,7 +14,6 @@ import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.node.DiscoveryNode;
@ -66,7 +65,6 @@ public class TransportClusterRerouteActionTests extends ESTestCase {
threadPool,
mock(AllocationService.class),
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
DefaultProjectResolver.INSTANCE
);
Mockito.clearInvocations(transportService);
@ -83,7 +81,6 @@ public class TransportClusterRerouteActionTests extends ESTestCase {
mock(ThreadPool.class),
mock(AllocationService.class),
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
TestProjectResolvers.allProjects()
);
@ -105,7 +102,6 @@ public class TransportClusterRerouteActionTests extends ESTestCase {
mock(ThreadPool.class),
mock(AllocationService.class),
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
TestProjectResolvers.singleProject(randomProjectIdOrDefault())
);

View file

@ -10,7 +10,6 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.routing.RerouteService;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.bytes.BytesReference;
@ -97,7 +96,6 @@ public class ClusterUpdateSettingsRequestTests extends ESTestCase {
mock(RerouteService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
clusterSettings
);

View file

@ -16,7 +16,6 @@ import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.metadata.MetadataCreateIndexService;
import org.elasticsearch.cluster.metadata.ProjectId;
@ -33,7 +32,6 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.elasticsearch.indices.SystemIndices;
import org.elasticsearch.indices.TestIndexNameExpressionResolver;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.MockUtils;
@ -130,10 +128,6 @@ public class TransportCreateIndexActionTests extends ESTestCase {
super.setUp();
threadContext = new ThreadContext(Settings.EMPTY);
final var projectResolver = TestProjectResolvers.usingRequestHeader(threadContext);
IndexNameExpressionResolver indexNameExpressionResolver = TestIndexNameExpressionResolver.newInstance(
SYSTEM_INDICES,
projectResolver
);
this.metadataCreateIndexService = mock(MetadataCreateIndexService.class);
final ThreadPool threadPool = mock(ThreadPool.class);

View file

@ -694,7 +694,6 @@ public class ReservedComposableIndexTemplateActionTests extends ESTestCase {
threadPool,
null,
mock(ActionFilters.class),
null,
TestProjectResolvers.singleProjectOnly()
);
assertEquals(ReservedComposableIndexTemplateAction.NAME, putIndexAction.reservedStateHandlerName().get());
@ -708,7 +707,6 @@ public class ReservedComposableIndexTemplateActionTests extends ESTestCase {
threadPool,
null,
mock(ActionFilters.class),
null,
TestProjectResolvers.singleProjectOnly()
);
assertEquals(ReservedComposableIndexTemplateAction.NAME, delIndexAction.reservedStateHandlerName().get());
@ -723,7 +721,6 @@ public class ReservedComposableIndexTemplateActionTests extends ESTestCase {
threadPool,
null,
mock(ActionFilters.class),
null,
indexScopedSettings,
TestProjectResolvers.singleProjectOnly()
);
@ -739,7 +736,6 @@ public class ReservedComposableIndexTemplateActionTests extends ESTestCase {
threadPool,
null,
mock(ActionFilters.class),
null,
TestProjectResolvers.singleProjectOnly()
);
assertEquals(ReservedComposableIndexTemplateAction.NAME, delComponentAction.reservedStateHandlerName().get());
@ -963,7 +959,6 @@ public class ReservedComposableIndexTemplateActionTests extends ESTestCase {
threadPool,
null,
mock(ActionFilters.class),
null,
TestProjectResolvers.singleProjectOnly()
);

View file

@ -313,13 +313,21 @@ public class RootObjectMapperTests extends MapperServiceTestCase {
public void testRuntimeSectionNonRuntimeType() throws IOException {
XContentBuilder mapping = runtimeFieldMapping(builder -> builder.field("type", "unknown"));
MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(mapping));
assertEquals("Failed to parse mapping: No handler for type [unknown] declared on runtime field [field]", e.getMessage());
assertEquals(
"Failed to parse mapping: The mapper type [unknown] declared on runtime field [field] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed. Check the documentation.",
e.getMessage()
);
}
public void testRuntimeSectionHandlerNotFound() throws IOException {
XContentBuilder mapping = runtimeFieldMapping(builder -> builder.field("type", "unknown"));
MapperParsingException e = expectThrows(MapperParsingException.class, () -> createMapperService(mapping));
assertEquals("Failed to parse mapping: No handler for type [unknown] declared on runtime field [field]", e.getMessage());
assertEquals(
"Failed to parse mapping: The mapper type [unknown] declared on runtime field [field] does not exist."
+ " It might have been created within a future version or requires a plugin to be installed. Check the documentation.",
e.getMessage()
);
}
public void testRuntimeSectionMissingType() throws IOException {

View file

@ -351,7 +351,6 @@ public class ClusterStateChanges {
threadPool,
allocationService,
actionFilters,
indexNameExpressionResolver,
TestProjectResolvers.DEFAULT_PROJECT_ONLY
);
transportCreateIndexAction = new TransportCreateIndexAction(

View file

@ -2501,14 +2501,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
);
actions.put(
TransportRestoreSnapshotAction.TYPE,
new TransportRestoreSnapshotAction(
transportService,
clusterService,
threadPool,
restoreService,
actionFilters,
indexNameExpressionResolver
)
new TransportRestoreSnapshotAction(transportService, clusterService, threadPool, restoreService, actionFilters)
);
actions.put(
TransportDeleteIndexAction.TYPE,
@ -2525,47 +2518,19 @@ public class SnapshotResiliencyTests extends ESTestCase {
);
actions.put(
TransportPutRepositoryAction.TYPE,
new TransportPutRepositoryAction(
transportService,
clusterService,
repositoriesService,
threadPool,
actionFilters,
indexNameExpressionResolver
)
new TransportPutRepositoryAction(transportService, clusterService, repositoriesService, threadPool, actionFilters)
);
actions.put(
TransportCleanupRepositoryAction.TYPE,
new TransportCleanupRepositoryAction(
transportService,
clusterService,
repositoriesService,
threadPool,
actionFilters,
indexNameExpressionResolver
)
new TransportCleanupRepositoryAction(transportService, clusterService, repositoriesService, threadPool, actionFilters)
);
actions.put(
TransportCreateSnapshotAction.TYPE,
new TransportCreateSnapshotAction(
transportService,
clusterService,
threadPool,
snapshotsService,
actionFilters,
indexNameExpressionResolver
)
new TransportCreateSnapshotAction(transportService, clusterService, threadPool, snapshotsService, actionFilters)
);
actions.put(
TransportCloneSnapshotAction.TYPE,
new TransportCloneSnapshotAction(
transportService,
clusterService,
threadPool,
snapshotsService,
actionFilters,
indexNameExpressionResolver
)
new TransportCloneSnapshotAction(transportService, clusterService, threadPool, snapshotsService, actionFilters)
);
actions.put(
TransportClusterRerouteAction.TYPE,
@ -2575,7 +2540,6 @@ public class SnapshotResiliencyTests extends ESTestCase {
threadPool,
allocationService,
actionFilters,
indexNameExpressionResolver,
TestProjectResolvers.singleProjectOnly()
)
);
@ -2616,14 +2580,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
);
actions.put(
TransportDeleteSnapshotAction.TYPE,
new TransportDeleteSnapshotAction(
transportService,
clusterService,
threadPool,
snapshotsService,
actionFilters,
indexNameExpressionResolver
)
new TransportDeleteSnapshotAction(transportService, clusterService, threadPool, snapshotsService, actionFilters)
);
client.initialize(
actions,

View file

@ -10,7 +10,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.protocol.xpack.XPackUsageRequest;
@ -32,7 +31,6 @@ public class AnalyticsUsageTransportAction extends XPackUsageFeatureTransportAct
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Client client
) {
super(XPackUsageFeatureAction.ANALYTICS.name(), transportService, clusterService, threadPool, actionFilters);

View file

@ -70,7 +70,6 @@ public class AnalyticsInfoTransportActionTests extends ESTestCase {
clusterService,
threadPool,
mock(ActionFilters.class),
null,
client
);
PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>();
@ -98,7 +97,6 @@ public class AnalyticsInfoTransportActionTests extends ESTestCase {
clusterService,
threadPool,
mock(ActionFilters.class),
null,
client
);
PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>();

View file

@ -19,7 +19,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.regex.Regex;
@ -46,8 +45,7 @@ public class TransportDeleteAutoscalingPolicyAction extends AcknowledgedTranspor
final TransportService transportService,
final ClusterService clusterService,
final ThreadPool threadPool,
final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver
final ActionFilters actionFilters
) {
super(
DeleteAutoscalingPolicyAction.NAME,

View file

@ -15,7 +15,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterInfoService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -53,7 +52,6 @@ public class TransportGetAutoscalingCapacityAction extends TransportMasterNodeAc
final ClusterService clusterService,
final ThreadPool threadPool,
final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver,
final AutoscalingCalculateCapacityService.Holder capacityServiceHolder,
final ClusterInfoService clusterInfoService,
final SnapshotsInfoService snapshotsInfoService,

View file

@ -14,7 +14,6 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.injection.guice.Inject;
@ -40,7 +39,6 @@ public class TransportGetAutoscalingPolicyAction extends TransportMasterNodeActi
final ClusterService clusterService,
final ThreadPool threadPool,
final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver,
final AutoscalingLicenseChecker autoscalingLicenseChecker
) {
super(

View file

@ -18,7 +18,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
@ -53,19 +52,10 @@ public class TransportPutAutoscalingPolicyAction extends AcknowledgedTransportMa
final ClusterService clusterService,
final ThreadPool threadPool,
final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver,
final AutoscalingCalculateCapacityService.Holder policyValidatorHolder,
final AutoscalingLicenseChecker autoscalingLicenseChecker
) {
this(
transportService,
clusterService,
threadPool,
actionFilters,
indexNameExpressionResolver,
policyValidatorHolder.get(),
autoscalingLicenseChecker
);
this(transportService, clusterService, threadPool, actionFilters, policyValidatorHolder.get(), autoscalingLicenseChecker);
}
TransportPutAutoscalingPolicyAction(
@ -73,7 +63,6 @@ public class TransportPutAutoscalingPolicyAction extends AcknowledgedTransportMa
final ClusterService clusterService,
final ThreadPool threadPool,
final ActionFilters actionFilters,
final IndexNameExpressionResolver indexNameExpressionResolver,
final PolicyValidator policyValidator,
final AutoscalingLicenseChecker autoscalingLicenseChecker
) {

View file

@ -15,7 +15,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.coordination.NoMasterBlockService;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.regex.Regex;
@ -46,8 +45,7 @@ public class TransportDeleteAutoscalingPolicyActionTests extends AutoscalingTest
transportService,
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class)
mock(ActionFilters.class)
);
final ClusterBlocks blocks = ClusterBlocks.builder()
.addGlobalBlock(
@ -73,8 +71,7 @@ public class TransportDeleteAutoscalingPolicyActionTests extends AutoscalingTest
transportService,
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class)
mock(ActionFilters.class)
);
final ClusterBlocks blocks = ClusterBlocks.builder().build();
final ClusterState state = ClusterState.builder(new ClusterName(randomAlphaOfLength(8))).blocks(blocks).build();

View file

@ -15,7 +15,6 @@ import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.rest.RestStatus;
@ -45,7 +44,6 @@ public class TransportGetAutoscalingPolicyActionTests extends AutoscalingTestCas
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
new AutoscalingLicenseChecker(() -> true)
);
final ClusterBlocks blocks = ClusterBlocks.builder()
@ -77,7 +75,6 @@ public class TransportGetAutoscalingPolicyActionTests extends AutoscalingTestCas
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
new AutoscalingLicenseChecker(() -> true)
);
final ClusterBlocks blocks = ClusterBlocks.builder().build();

View file

@ -14,7 +14,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.coordination.NoMasterBlockService;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.test.MockUtils;
@ -49,7 +48,6 @@ public class TransportPutAutoscalingPolicyActionTests extends AutoscalingTestCas
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
NO_VALIDATION,
new AutoscalingLicenseChecker(() -> true)
);
@ -75,7 +73,6 @@ public class TransportPutAutoscalingPolicyActionTests extends AutoscalingTestCas
mock(ClusterService.class),
threadPool,
mock(ActionFilters.class),
mock(IndexNameExpressionResolver.class),
NO_VALIDATION,
new AutoscalingLicenseChecker(() -> true)
);

View file

@ -10,7 +10,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
@ -40,7 +39,6 @@ public class CCRUsageTransportAction extends XPackUsageFeatureTransportAction {
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Settings settings,
XPackLicenseState licenseState
) {

View file

@ -16,7 +16,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.SuppressForbidden;
@ -38,8 +37,7 @@ public class TransportActivateAutoFollowPatternAction extends AcknowledgedTransp
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver resolver
ActionFilters actionFilters
) {
super(
ActivateAutoFollowPatternAction.NAME,

Some files were not shown because too many files have changed in this diff Show more