|
@@ -61,8 +61,8 @@ public class CsvTestsDataLoader {
|
|
|
private static final TestsDataset APPS = new TestsDataset("apps");
|
|
|
private static final TestsDataset APPS_SHORT = APPS.withIndex("apps_short").withTypeMapping(Map.of("id", "short"));
|
|
|
private static final TestsDataset LANGUAGES = new TestsDataset("languages");
|
|
|
- // private static final TestsDataset LANGUAGES_LOOKUP = LANGUAGES.withIndex("languages_lookup")
|
|
|
- // .withSetting("languages_lookup-settings.json");
|
|
|
+ private static final TestsDataset LANGUAGES_LOOKUP = LANGUAGES.withIndex("languages_lookup")
|
|
|
+ .withSetting("languages_lookup-settings.json");
|
|
|
private static final TestsDataset ALERTS = new TestsDataset("alerts");
|
|
|
private static final TestsDataset UL_LOGS = new TestsDataset("ul_logs");
|
|
|
private static final TestsDataset SAMPLE_DATA = new TestsDataset("sample_data");
|
|
@@ -77,11 +77,11 @@ public class CsvTestsDataLoader {
|
|
|
.withTypeMapping(Map.of("@timestamp", "date_nanos"));
|
|
|
private static final TestsDataset MISSING_IP_SAMPLE_DATA = new TestsDataset("missing_ip_sample_data");
|
|
|
private static final TestsDataset CLIENT_IPS = new TestsDataset("clientips");
|
|
|
- // private static final TestsDataset CLIENT_IPS_LOOKUP = CLIENT_IPS.withIndex("clientips_lookup")
|
|
|
- // .withSetting("clientips_lookup-settings.json");
|
|
|
+ private static final TestsDataset CLIENT_IPS_LOOKUP = CLIENT_IPS.withIndex("clientips_lookup")
|
|
|
+ .withSetting("clientips_lookup-settings.json");
|
|
|
private static final TestsDataset MESSAGE_TYPES = new TestsDataset("message_types");
|
|
|
- // private static final TestsDataset MESSAGE_TYPES_LOOKUP = MESSAGE_TYPES.withIndex("message_types_lookup")
|
|
|
- // .withSetting("message_types_lookup-settings.json");
|
|
|
+ private static final TestsDataset MESSAGE_TYPES_LOOKUP = MESSAGE_TYPES.withIndex("message_types_lookup")
|
|
|
+ .withSetting("message_types_lookup-settings.json");
|
|
|
private static final TestsDataset CLIENT_CIDR = new TestsDataset("client_cidr");
|
|
|
private static final TestsDataset AGES = new TestsDataset("ages");
|
|
|
private static final TestsDataset HEIGHTS = new TestsDataset("heights");
|
|
@@ -113,7 +113,7 @@ public class CsvTestsDataLoader {
|
|
|
Map.entry(APPS.indexName, APPS),
|
|
|
Map.entry(APPS_SHORT.indexName, APPS_SHORT),
|
|
|
Map.entry(LANGUAGES.indexName, LANGUAGES),
|
|
|
- // Map.entry(LANGUAGES_LOOKUP.indexName, LANGUAGES_LOOKUP),
|
|
|
+ Map.entry(LANGUAGES_LOOKUP.indexName, LANGUAGES_LOOKUP),
|
|
|
Map.entry(UL_LOGS.indexName, UL_LOGS),
|
|
|
Map.entry(SAMPLE_DATA.indexName, SAMPLE_DATA),
|
|
|
Map.entry(MV_SAMPLE_DATA.indexName, MV_SAMPLE_DATA),
|
|
@@ -123,9 +123,9 @@ public class CsvTestsDataLoader {
|
|
|
Map.entry(SAMPLE_DATA_TS_NANOS.indexName, SAMPLE_DATA_TS_NANOS),
|
|
|
Map.entry(MISSING_IP_SAMPLE_DATA.indexName, MISSING_IP_SAMPLE_DATA),
|
|
|
Map.entry(CLIENT_IPS.indexName, CLIENT_IPS),
|
|
|
- // Map.entry(CLIENT_IPS_LOOKUP.indexName, CLIENT_IPS_LOOKUP),
|
|
|
+ Map.entry(CLIENT_IPS_LOOKUP.indexName, CLIENT_IPS_LOOKUP),
|
|
|
Map.entry(MESSAGE_TYPES.indexName, MESSAGE_TYPES),
|
|
|
- // Map.entry(MESSAGE_TYPES_LOOKUP.indexName, MESSAGE_TYPES_LOOKUP),
|
|
|
+ Map.entry(MESSAGE_TYPES_LOOKUP.indexName, MESSAGE_TYPES_LOOKUP),
|
|
|
Map.entry(CLIENT_CIDR.indexName, CLIENT_CIDR),
|
|
|
Map.entry(AGES.indexName, AGES),
|
|
|
Map.entry(HEIGHTS.indexName, HEIGHTS),
|
|
@@ -236,7 +236,7 @@ public class CsvTestsDataLoader {
|
|
|
}
|
|
|
|
|
|
try (RestClient client = builder.build()) {
|
|
|
- loadDataSetIntoEs(client, (restClient, indexName, indexMapping, indexSettings) -> {
|
|
|
+ loadDataSetIntoEs(client, true, (restClient, indexName, indexMapping, indexSettings) -> {
|
|
|
// don't use ESRestTestCase methods here or, if you do, test running the main method before making the change
|
|
|
StringBuilder jsonBody = new StringBuilder("{");
|
|
|
if (indexSettings != null && indexSettings.isEmpty() == false) {
|
|
@@ -255,26 +255,28 @@ public class CsvTestsDataLoader {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static Set<TestsDataset> availableDatasetsForEs(RestClient client) throws IOException {
|
|
|
+ public static Set<TestsDataset> availableDatasetsForEs(RestClient client, boolean supportsIndexModeLookup) throws IOException {
|
|
|
boolean inferenceEnabled = clusterHasInferenceEndpoint(client);
|
|
|
|
|
|
return CSV_DATASET_MAP.values()
|
|
|
.stream()
|
|
|
.filter(d -> d.requiresInferenceEndpoint == false || inferenceEnabled)
|
|
|
+ .filter(d -> supportsIndexModeLookup || d.indexName.endsWith("_lookup") == false) // TODO: use actual index settings
|
|
|
.collect(Collectors.toCollection(HashSet::new));
|
|
|
}
|
|
|
|
|
|
- public static void loadDataSetIntoEs(RestClient client) throws IOException {
|
|
|
- loadDataSetIntoEs(client, (restClient, indexName, indexMapping, indexSettings) -> {
|
|
|
+ public static void loadDataSetIntoEs(RestClient client, boolean supportsIndexModeLookup) throws IOException {
|
|
|
+ loadDataSetIntoEs(client, supportsIndexModeLookup, (restClient, indexName, indexMapping, indexSettings) -> {
|
|
|
ESRestTestCase.createIndex(restClient, indexName, indexSettings, indexMapping, null);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private static void loadDataSetIntoEs(RestClient client, IndexCreator indexCreator) throws IOException {
|
|
|
+ private static void loadDataSetIntoEs(RestClient client, boolean supportsIndexModeLookup, IndexCreator indexCreator)
|
|
|
+ throws IOException {
|
|
|
Logger logger = LogManager.getLogger(CsvTestsDataLoader.class);
|
|
|
|
|
|
Set<String> loadedDatasets = new HashSet<>();
|
|
|
- for (var dataset : availableDatasetsForEs(client)) {
|
|
|
+ for (var dataset : availableDatasetsForEs(client, supportsIndexModeLookup)) {
|
|
|
load(client, dataset, logger, indexCreator);
|
|
|
loadedDatasets.add(dataset.indexName);
|
|
|
}
|