forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-security-index-active-assertion
- Loading branch information
Showing
78 changed files
with
1,832 additions
and
1,526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,10 @@ | ||
apply plugin: 'elasticsearch.build' | ||
|
||
sourceSets { | ||
unsupportedJdkVersionEntrypoint | ||
} | ||
|
||
tasks.named(sourceSets.unsupportedJdkVersionEntrypoint.compileJavaTaskName).configure { | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
|
||
tasks.named("jar") { | ||
manifest { | ||
attributes("Multi-Release": "true") | ||
} | ||
|
||
FileCollection mainOutput = sourceSets.main.output; | ||
from(sourceSets.unsupportedJdkVersionEntrypoint.output) | ||
eachFile { details -> | ||
if (details.path.equals("org/elasticsearch/tools/java_version_checker/JavaVersionChecker.class") && | ||
mainOutput.asFileTree.contains(details.file)) { | ||
details.relativePath = details.relativePath.prepend("META-INF/versions/17") | ||
} | ||
} | ||
compileJava { | ||
options.release = 8 | ||
} | ||
|
||
// TODO revisit forbiddenApis issues | ||
["javadoc", "forbiddenApisMain", "forbiddenApisUnsupportedJdkVersionEntrypoint"].each { | ||
["javadoc", "forbiddenApisMain"].each { | ||
tasks.named(it).configure { enabled = false } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
...rsionEntrypoint/java/org/elasticsearch/tools/java_version_checker/JavaVersionChecker.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 112678 | ||
summary: Make "too many clauses" throw IllegalArgumentException to avoid 500s | ||
area: Search | ||
type: bug | ||
issues: | ||
- 112177 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 112888 | ||
summary: Fix `getDatabaseType` for unusual MMDBs | ||
area: Ingest Node | ||
type: bug | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
...s/src/javaRestTest/java/org/elasticsearch/datastreams/logsdb/qa/DataGenerationHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/* | ||
* 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.datastreams.logsdb.qa; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.core.CheckedConsumer; | ||
import org.elasticsearch.index.mapper.Mapper; | ||
import org.elasticsearch.index.mapper.ObjectMapper; | ||
import org.elasticsearch.logsdb.datageneration.DataGenerator; | ||
import org.elasticsearch.logsdb.datageneration.DataGeneratorSpecification; | ||
import org.elasticsearch.logsdb.datageneration.FieldDataGenerator; | ||
import org.elasticsearch.logsdb.datageneration.datasource.DataSourceHandler; | ||
import org.elasticsearch.logsdb.datageneration.datasource.DataSourceRequest; | ||
import org.elasticsearch.logsdb.datageneration.datasource.DataSourceResponse; | ||
import org.elasticsearch.logsdb.datageneration.fields.PredefinedField; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
class DataGenerationHelper { | ||
private final ObjectMapper.Subobjects subobjects; | ||
private final boolean keepArraySource; | ||
|
||
private final DataGenerator dataGenerator; | ||
|
||
DataGenerationHelper() { | ||
// TODO enable subobjects: auto | ||
// It is disabled because it currently does not have auto flattening and that results in asserts being triggered when using copy_to. | ||
this.subobjects = ESTestCase.randomValueOtherThan( | ||
ObjectMapper.Subobjects.AUTO, | ||
() -> ESTestCase.randomFrom(ObjectMapper.Subobjects.values()) | ||
); | ||
this.keepArraySource = ESTestCase.randomBoolean(); | ||
|
||
var specificationBuilder = DataGeneratorSpecification.builder().withFullyDynamicMapping(ESTestCase.randomBoolean()); | ||
if (subobjects != ObjectMapper.Subobjects.ENABLED) { | ||
specificationBuilder = specificationBuilder.withNestedFieldsLimit(0); | ||
} | ||
this.dataGenerator = new DataGenerator(specificationBuilder.withDataSourceHandlers(List.of(new DataSourceHandler() { | ||
@Override | ||
public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequest.ObjectMappingParametersGenerator request) { | ||
if (subobjects == ObjectMapper.Subobjects.ENABLED) { | ||
// Use default behavior | ||
return null; | ||
} | ||
|
||
assert request.isNested() == false; | ||
|
||
// "enabled: false" is not compatible with subobjects: false | ||
// "dynamic: false/strict/runtime" is not compatible with subobjects: false | ||
return new DataSourceResponse.ObjectMappingParametersGenerator(() -> { | ||
var parameters = new HashMap<String, Object>(); | ||
parameters.put("subobjects", subobjects.toString()); | ||
if (ESTestCase.randomBoolean()) { | ||
parameters.put("dynamic", "true"); | ||
} | ||
if (ESTestCase.randomBoolean()) { | ||
parameters.put("enabled", "true"); | ||
} | ||
return parameters; | ||
}); | ||
} | ||
})) | ||
.withPredefinedFields( | ||
List.of( | ||
// Customized because it always needs doc_values for aggregations. | ||
new PredefinedField.WithGenerator("host.name", new FieldDataGenerator() { | ||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> mappingWriter() { | ||
return b -> b.startObject().field("type", "keyword").endObject(); | ||
} | ||
|
||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> fieldValueGenerator() { | ||
return b -> b.value(ESTestCase.randomAlphaOfLength(5)); | ||
} | ||
}), | ||
// Needed for terms query | ||
new PredefinedField.WithGenerator("method", new FieldDataGenerator() { | ||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> mappingWriter() { | ||
return b -> b.startObject().field("type", "keyword").endObject(); | ||
} | ||
|
||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> fieldValueGenerator() { | ||
return b -> b.value(ESTestCase.randomFrom("put", "post", "get")); | ||
} | ||
}), | ||
|
||
// Needed for histogram aggregation | ||
new PredefinedField.WithGenerator("memory_usage_bytes", new FieldDataGenerator() { | ||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> mappingWriter() { | ||
return b -> b.startObject().field("type", "long").endObject(); | ||
} | ||
|
||
@Override | ||
public CheckedConsumer<XContentBuilder, IOException> fieldValueGenerator() { | ||
// We can generate this using standard long field but we would get "too many buckets" | ||
return b -> b.value(ESTestCase.randomLongBetween(1000, 2000)); | ||
} | ||
}) | ||
) | ||
) | ||
.build()); | ||
} | ||
|
||
DataGenerator getDataGenerator() { | ||
return dataGenerator; | ||
} | ||
|
||
void logsDbMapping(XContentBuilder builder) throws IOException { | ||
dataGenerator.writeMapping(builder); | ||
} | ||
|
||
void standardMapping(XContentBuilder builder) throws IOException { | ||
if (subobjects != ObjectMapper.Subobjects.ENABLED) { | ||
dataGenerator.writeMapping(builder, Map.of("subobjects", subobjects.toString())); | ||
} else { | ||
dataGenerator.writeMapping(builder); | ||
} | ||
} | ||
|
||
void logsDbSettings(Settings.Builder builder) { | ||
if (keepArraySource) { | ||
builder.put(Mapper.SYNTHETIC_SOURCE_KEEP_INDEX_SETTING.getKey(), "arrays"); | ||
} | ||
} | ||
} |
Oops, something went wrong.