diff --git a/muted-tests.yml b/muted-tests.yml index e3c0042adbc28..429cf9ad0ad86 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -540,27 +540,6 @@ tests: - class: org.elasticsearch.versioning.ConcurrentSeqNoVersioningIT method: testSeqNoCASLinearizability issue: https://github.com/elastic/elasticsearch/issues/117249 -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: test {p0=index/92_metrics_auto_subobjects/Metrics object indexing} -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: test {p0=index/92_metrics_auto_subobjects/Root without subobjects with synthetic source} -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: test {p0=index/92_metrics_auto_subobjects/Metrics object indexing with synthetic source} -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: "test {p0=indices.put_index_template/15_composition/Composable index templates that include subobjects: auto at root}" -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: "test {p0=search/330_fetch_fields/Test with subobjects: auto}" -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: "test {p0=indices.put_index_template/15_composition/Composable index templates that include subobjects: auto on arbitrary field}" -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - issue: https://github.com/elastic/elasticsearch/issues/138649 - method: test {p0=index/92_metrics_auto_subobjects/Root with metrics} # Examples: # diff --git a/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/CcsCommonYamlTestSuiteIT.java b/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/CcsCommonYamlTestSuiteIT.java index da7f1feeae2ea..7b94126ec6089 100644 --- a/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/CcsCommonYamlTestSuiteIT.java +++ b/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/CcsCommonYamlTestSuiteIT.java @@ -98,7 +98,6 @@ public class CcsCommonYamlTestSuiteIT extends ESClientYamlSuiteTestCase { // geohex_grid requires gold license .setting("xpack.license.self_generated.type", "trial") .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .feature(FeatureFlag.SYNTHETIC_VECTORS); private static ElasticsearchCluster remoteCluster = ElasticsearchCluster.local() diff --git a/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java b/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java index e7c3673dadc96..bd961639b482a 100644 --- a/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java +++ b/qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java @@ -97,7 +97,6 @@ public class RcsCcsCommonYamlTestSuiteIT extends ESClientYamlSuiteTestCase { .setting("xpack.security.remote_cluster_server.ssl.enabled", "false") .setting("xpack.security.remote_cluster_client.ssl.enabled", "false") .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .feature(FeatureFlag.SYNTHETIC_VECTORS) .user("test_admin", "x-pack-test-password"); diff --git a/qa/mixed-cluster/build.gradle b/qa/mixed-cluster/build.gradle index a591d4c590b27..dfe4052b09aff 100644 --- a/qa/mixed-cluster/build.gradle +++ b/qa/mixed-cluster/build.gradle @@ -89,7 +89,6 @@ buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName -> setting 'health.master_history.no_master_transitions_threshold', '10' } requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0") - requiresFeature 'sub_objects_auto', Version.fromString("8.16.0") if (bwcVersion.before(Version.fromString("8.18.0"))) { jvmArgs '-da:org.elasticsearch.index.mapper.DocumentMapper' jvmArgs '-da:org.elasticsearch.index.mapper.MapperService' diff --git a/qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java b/qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java index 5014fd6c06be9..82d22102598fe 100644 --- a/qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java +++ b/qa/smoke-test-multinode/src/yamlRestTest/java/org/elasticsearch/smoketest/SmokeTestMultiNodeClientYamlTestSuiteIT.java @@ -35,7 +35,6 @@ public class SmokeTestMultiNodeClientYamlTestSuiteIT extends ESClientYamlSuiteTe // The first node does not have the ingest role so we're sure ingest requests are forwarded: .node(0, n -> n.setting("node.roles", "[master,data,ml,remote_cluster_client,transform]")) .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .feature(FeatureFlag.DOC_VALUES_SKIPPER) .feature(FeatureFlag.SYNTHETIC_VECTORS) .build(); diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle index ac9171995e317..967a92c800f4a 100644 --- a/rest-api-spec/build.gradle +++ b/rest-api-spec/build.gradle @@ -61,6 +61,7 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task -> task.replaceValueInMatch("profile.shards.0.dfs.knn.0.collector.0.name", "TopScoreDocCollector", "dfs knn vector profiling with vector_operations_count") task.skipTest("cat.aliases/10_basic/Deprecated local parameter", "CAT APIs not covered by compatibility policy") task.skipTest("cat.shards/10_basic/Help", "sync_id is removed in 9.0") + task.skipTest("search/330_fetch_fields/Test with subobjects: auto", "subobjects auto removed") task.skipTest("search/500_date_range/from, to, include_lower, include_upper deprecated", "deprecated parameters are removed in 9.0") task.skipTest("search.highlight/30_max_analyzed_offset/Plain highlighter with max_analyzed_offset < 0 should FAIL", "semantics of test has changed") task.skipTest("search.vectors/70_dense_vector_telemetry/Field mapping stats with field details", "default dense vector field mapping has changed") @@ -72,9 +73,15 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task -> task.skipTest("range/20_synthetic_source/Date range Rounding Fixes", "_source.mode mapping attribute is no-op since 9.0.0") task.skipTest("index/92_metrics_auto_subobjects/Metrics object indexing with synthetic source", "_source.mode mapping attribute is no-op since 9.0.0") task.skipTest("index/92_metrics_auto_subobjects/Root without subobjects with synthetic source", "_source.mode mapping attribute is no-op since 9.0.0") + task.skipTest("index/92_metrics_auto_subobjects/Root with metrics", "subobjects auto removed") + task.skipTest("index/92_metrics_auto_subobjects/Metrics object indexing", "subobjects auto removed") task.skipTest("index/91_metrics_no_subobjects/Metrics object indexing with synthetic source", "_source.mode mapping attribute is no-op since 9.0.0") task.skipTest("index/91_metrics_no_subobjects/Root without subobjects with synthetic source", "_source.mode mapping attribute is no-op since 9.0.0") + task.skipTest("indices.create/20_synthetic_source/subobjects auto", "subobjects auto removed") task.skipTest("indices.create/20_synthetic_source/synthetic_source with copy_to inside nested object", "temporary until backported") + task.skipTest("indices.create/20_synthetic_source/synthetic_source with copy_to pointing to ambiguous field and subobjects auto", "subobjects auto removed") + task.skipTest("indices.put_index_template/15_composition/Composable index templates that include subobjects: auto on arbitrary field", "subobjects auto removed") + task.skipTest("indices.put_index_template/15_composition/Composable index templates that include subobjects: auto at root", "subobjects auto removed") task.skipTest( "cluster.desired_nodes/10_basic/Test delete desired nodes with node_version generates a warning", "node_version warning is removed in 9.0" diff --git a/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java b/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java index fc68e496801b7..977a30eb3a920 100644 --- a/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java +++ b/rest-api-spec/src/yamlRestTest/java/org/elasticsearch/test/rest/ClientYamlTestSuiteIT.java @@ -35,7 +35,6 @@ public class ClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { .module("health-shards-availability") .module("data-streams") .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .feature(FeatureFlag.DOC_VALUES_SKIPPER) .feature(FeatureFlag.SYNTHETIC_VECTORS) .build(); diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/index/92_metrics_auto_subobjects.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/index/92_metrics_auto_subobjects.yml deleted file mode 100644 index 9d1a9793b1f55..0000000000000 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/index/92_metrics_auto_subobjects.yml +++ /dev/null @@ -1,258 +0,0 @@ ---- -"Metrics object indexing": - - requires: - test_runner_features: [ "allowed_warnings", "allowed_warnings_regex" ] - reason: requires supporting subobjects auto setting - - - do: - allowed_warnings: - - "index template [test] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test] will take precedence during new index creation" - indices.put_index_template: - name: test - body: - index_patterns: test-* - template: - mappings: - dynamic_templates: - - no_subobjects: - match: metrics - mapping: - type: object - subobjects: auto - properties: - host.name: - type: keyword - - - do: - allowed_warnings_regex: - - "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template" - index: - index: test-1 - id: 1 - refresh: true - body: - { metrics.host.name: localhost, metrics.host.id: 1, metrics.time: 10, metrics.time.max: 100, metrics.time.min: 1 } - - - do: - field_caps: - index: test-1 - fields: metrics* - - match: {fields.metrics\.host\.id.long.searchable: true} - - match: {fields.metrics\.host\.id.long.aggregatable: true} - - match: {fields.metrics\.host\.name.keyword.searchable: true} - - match: {fields.metrics\.host\.name.keyword.aggregatable: true} - - match: {fields.metrics\.time.long.searchable: true} - - match: {fields.metrics\.time.long.aggregatable: true} - - match: {fields.metrics\.time\.max.long.searchable: true} - - match: {fields.metrics\.time\.max.long.aggregatable: true} - - match: {fields.metrics\.time\.min.long.searchable: true} - - match: {fields.metrics\.time\.min.long.aggregatable: true} - - - do: - get: - index: test-1 - id: 1 - - match: {_index: "test-1"} - - match: {_id: "1"} - - match: {_version: 1} - - match: {found: true} - - match: - _source: - metrics.host.name: localhost - metrics.host.id: 1 - metrics.time: 10 - metrics.time.max: 100 - metrics.time.min: 1 - ---- -"Root with metrics": - - requires: - test_runner_features: [ "allowed_warnings", "allowed_warnings_regex" ] - reason: requires supporting subobjects auto setting - - - do: - allowed_warnings: - - "index template [test] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test] will take precedence during new index creation" - indices.put_index_template: - name: test - body: - index_patterns: test-* - template: - mappings: - subobjects: auto - properties: - host.name: - type: keyword - - - do: - allowed_warnings_regex: - - "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template" - index: - index: test-1 - id: 1 - refresh: true - body: - { host.name: localhost, host.id: 1, time: 10, time.max: 100, time.min: 1 } - - - do: - field_caps: - index: test-1 - fields: [host*, time*] - - match: {fields.host\.name.keyword.searchable: true} - - match: {fields.host\.name.keyword.aggregatable: true} - - match: {fields.host\.id.long.searchable: true} - - match: {fields.host\.id.long.aggregatable: true} - - match: {fields.time.long.searchable: true} - - match: {fields.time.long.aggregatable: true} - - match: {fields.time\.max.long.searchable: true} - - match: {fields.time\.max.long.aggregatable: true} - - match: {fields.time\.min.long.searchable: true} - - match: {fields.time\.min.long.aggregatable: true} - - - do: - get: - index: test-1 - id: 1 - - match: {_index: "test-1"} - - match: {_id: "1"} - - match: {_version: 1} - - match: {found: true} - - match: - _source: - host.name: localhost - host.id: 1 - time: 10 - time.max: 100 - time.min: 1 - ---- -"Metrics object indexing with synthetic source": - - requires: - test_runner_features: [ "allowed_warnings", "allowed_warnings_regex" ] - reason: added in 8.4.0 - - - do: - allowed_warnings: - - "index template [test] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test] will take precedence during new index creation" - indices.put_index_template: - name: test - body: - index_patterns: test-* - template: - settings: - index.mapping.source.mode: synthetic - mappings: - dynamic_templates: - - no_subobjects: - match: metrics - mapping: - type: object - subobjects: auto - properties: - host.name: - type: keyword - - - do: - allowed_warnings_regex: - - "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template" - index: - index: test-1 - id: 1 - refresh: true - body: - { metrics.host.name: localhost, metrics.host.id: 1, metrics.time: 10, metrics.time.max: 100, metrics.time.min: 1 } - - - do: - field_caps: - index: test-1 - fields: metrics* - - match: {fields.metrics\.host\.id.long.searchable: true} - - match: {fields.metrics\.host\.id.long.aggregatable: true} - - match: {fields.metrics\.host\.name.keyword.searchable: true} - - match: {fields.metrics\.host\.name.keyword.aggregatable: true} - - match: {fields.metrics\.time.long.searchable: true} - - match: {fields.metrics\.time.long.aggregatable: true} - - match: {fields.metrics\.time\.max.long.searchable: true} - - match: {fields.metrics\.time\.max.long.aggregatable: true} - - match: {fields.metrics\.time\.min.long.searchable: true} - - match: {fields.metrics\.time\.min.long.aggregatable: true} - - - do: - get: - index: test-1 - id: 1 - - match: {_index: "test-1"} - - match: {_id: "1"} - - match: {_version: 1} - - match: {found: true} - - match: - _source: - metrics: - host.name: localhost - host.id: 1 - time: 10 - time.max: 100 - time.min: 1 - ---- -"Root without subobjects with synthetic source": - - requires: - test_runner_features: [ "allowed_warnings", "allowed_warnings_regex" ] - reason: added in 8.4.0 - - - do: - allowed_warnings: - - "index template [test] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test] will take precedence during new index creation" - indices.put_index_template: - name: test - body: - index_patterns: test-* - template: - settings: - index.mapping.source.mode: synthetic - mappings: - subobjects: auto - properties: - host.name: - type: keyword - - - do: - allowed_warnings_regex: - - "index \\[test-1\\] matches multiple legacy templates \\[global, test\\], composable templates will only match a single template" - index: - index: test-1 - id: 1 - refresh: true - body: - { host.name: localhost, host.id: 1, time: 10, time.max: 100, time.min: 1 } - - - do: - field_caps: - index: test-1 - fields: [host*, time*] - - match: {fields.host\.name.keyword.searchable: true} - - match: {fields.host\.name.keyword.aggregatable: true} - - match: {fields.host\.id.long.searchable: true} - - match: {fields.host\.id.long.aggregatable: true} - - match: {fields.time.long.searchable: true} - - match: {fields.time.long.aggregatable: true} - - match: {fields.time\.max.long.searchable: true} - - match: {fields.time\.max.long.aggregatable: true} - - match: {fields.time\.min.long.searchable: true} - - match: {fields.time\.min.long.aggregatable: true} - - - do: - get: - index: test-1 - id: 1 - - match: {_index: "test-1"} - - match: {_id: "1"} - - match: {_version: 1} - - match: {found: true} - - match: - _source: - host.name: localhost - host.id: 1 - time: 10 - time.max: 100 - time.min: 1 diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/20_synthetic_source.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/20_synthetic_source.yml index b19915d179b04..94648e09b7ab8 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/20_synthetic_source.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/20_synthetic_source.yml @@ -856,91 +856,6 @@ doubly nested object: - match: { hits.hits.3._source.id: 3 } ---- -subobjects auto: - - do: - indices.create: - index: test - body: - settings: - index: - mapping.source.mode: synthetic - mappings: - subobjects: auto - properties: - id: - type: integer - regular: - properties: - span: - properties: - id: - type: keyword - trace: - properties: - id: - type: keyword - stored: - synthetic_source_keep: arrays - properties: - span: - properties: - id: - type: keyword - trace: - properties: - id: - type: keyword - nested: - type: nested - auto_obj: - type: object - subobjects: auto - - - do: - bulk: - index: test - refresh: true - body: - - '{ "create": { } }' - - '{ "id": 1, "foo": 10, "foo.bar": 100, "regular": [ { "trace": { "id": "a" }, "span": { "id": "1" } }, { "trace": { "id": "b" }, "span": { "id": "1" } } ] }' - - '{ "create": { } }' - - '{ "id": 2, "foo": 20, "foo.bar": 200, "stored": [ { "trace": { "id": "a" }, "span": { "id": "1" } }, { "trace": { "id": "b" }, "span": { "id": "1" } } ] }' - - '{ "create": { } }' - - '{ "id": 3, "foo": 30, "foo.bar": 300, "nested": [ { "a": 10, "b": 20 }, { "a": 100, "b": 200 } ] }' - - '{ "create": { } }' - - '{ "id": 4, "auto_obj": { "foo": 40, "foo.bar": 400 } }' - - - match: { errors: false } - - - do: - search: - index: test - sort: id - - - match: { hits.hits.0._source.id: 1 } - - match: { hits.hits.0._source.foo: 10 } - - match: { hits.hits.0._source.foo\.bar: 100 } - - match: { hits.hits.0._source.regular.span.id: "1" } - - match: { hits.hits.0._source.regular.trace.id: ["a", "b" ] } - - match: { hits.hits.1._source.id: 2 } - - match: { hits.hits.1._source.foo: 20 } - - match: { hits.hits.1._source.foo\.bar: 200 } - - match: { hits.hits.1._source.stored.0.trace.id: a } - - match: { hits.hits.1._source.stored.0.span.id: "1" } - - match: { hits.hits.1._source.stored.1.trace.id: b } - - match: { hits.hits.1._source.stored.1.span.id: "1" } - - match: { hits.hits.2._source.id: 3 } - - match: { hits.hits.2._source.foo: 30 } - - match: { hits.hits.2._source.foo\.bar: 300 } - - match: { hits.hits.2._source.nested.0.a: 10 } - - match: { hits.hits.2._source.nested.0.b: 20 } - - match: { hits.hits.2._source.nested.1.a: 100 } - - match: { hits.hits.2._source.nested.1.b: 200 } - - match: { hits.hits.3._source.id: 4 } - - match: { hits.hits.3._source.auto_obj.foo: 40 } - - match: { hits.hits.3._source.auto_obj.foo\.bar: 400 } - --- synthetic_source with copy_to: - do: @@ -1759,50 +1674,6 @@ synthetic_source with copy_to pointing to ambiguous field and subobjects false: hits.hits.0.fields: a.b.c: [ "hey" ] ---- -synthetic_source with copy_to pointing to ambiguous field and subobjects auto: - - do: - indices.create: - index: test - body: - settings: - index: - mapping.source.mode: synthetic - mappings: - subobjects: auto - properties: - k: - type: keyword - copy_to: a.b.c - a: - properties: - b: - properties: - c: - type: keyword - b.c: - type: keyword - - - do: - index: - index: test - id: 1 - refresh: true - body: - k: "hey" - - - do: - search: - index: test - body: - docvalue_fields: [ "a.b.c" ] - - - match: - hits.hits.0._source: - k: "hey" - - match: - hits.hits.0.fields: - a.b.c: [ "hey" ] --- synthetic_source with copy_to pointing at dynamic field: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_index_template/15_composition.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_index_template/15_composition.yml index 89816be5ca8e7..45bcf64f98945 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_index_template/15_composition.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.put_index_template/15_composition.yml @@ -449,111 +449,6 @@ index: test-generic - match: { test-generic.mappings.properties.parent.properties.child\.grandchild.type: "keyword" } - ---- -"Composable index templates that include subobjects: auto at root": - - requires: - test_runner_features: "allowed_warnings" - - - do: - cluster.put_component_template: - name: test-subobjects - body: - template: - mappings: - subobjects: auto - properties: - message: - enabled: false - - - do: - cluster.put_component_template: - name: test-field - body: - template: - mappings: - properties: - parent.subfield: - type: keyword - - - do: - allowed_warnings: - - "index template [test-composable-template] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test-composable-template] will take precedence during new index creation" - indices.put_index_template: - name: test-composable-template - body: - index_patterns: - - test-* - composed_of: - - test-subobjects - - test-field - - is_true: acknowledged - - - do: - indices.create: - index: test-generic - - - do: - indices.get_mapping: - index: test-generic - - match: { test-generic.mappings.properties.parent\.subfield.type: "keyword" } - - match: { test-generic.mappings.properties.message.type: "object" } - ---- -"Composable index templates that include subobjects: auto on arbitrary field": - - requires: - test_runner_features: "allowed_warnings" - - - do: - cluster.put_component_template: - name: test-subobjects - body: - template: - mappings: - properties: - parent: - type: object - subobjects: auto - properties: - message: - enabled: false - - - do: - cluster.put_component_template: - name: test-subfield - body: - template: - mappings: - properties: - parent: - properties: - child.grandchild: - type: keyword - - - do: - allowed_warnings: - - "index template [test-composable-template] has index patterns [test-*] matching patterns from existing older templates [global] with patterns (global => [*]); this template [test-composable-template] will take precedence during new index creation" - indices.put_index_template: - name: test-composable-template - body: - index_patterns: - - test-* - composed_of: - - test-subobjects - - test-subfield - - is_true: acknowledged - - - do: - indices.create: - index: test-generic - - - do: - indices.get_mapping: - index: test-generic - - match: { test-generic.mappings.properties.parent.properties.child\.grandchild.type: "keyword" } - - match: { test-generic.mappings.properties.parent.properties.message.type: "object" } - - --- "Composition of component templates with different legal field mappings": - skip: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/330_fetch_fields.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/330_fetch_fields.yml index 8915325c3a67b..06fa5d242f9c4 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/330_fetch_fields.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/330_fetch_fields.yml @@ -1126,54 +1126,6 @@ fetch geo_point: - match: { hits.hits.0.fields.root\.subfield.0: 'child' } - match: { hits.hits.0.fields.root\.subfield\.keyword.0: 'child' } ---- -"Test with subobjects: auto": - - do: - indices.create: - index: test - body: - mappings: - subobjects: auto - properties: - message: - type: object - subobjects: auto - enabled: false - - - do: - index: - index: test - refresh: true - body: > - { - "root": "parent", - "root.subfield": "child", - "message": { - "foo": 10, - "foo.bar": 20 - } - } - - match: {result: "created"} - - - do: - search: - index: test - body: - query: - term: - root.subfield: - value: 'child' - fields: - - field: 'root*' - - length: { hits.hits: 1 } - - match: { hits.hits.0.fields.root.0: 'parent' } - - match: { hits.hits.0.fields.root\.keyword.0: 'parent' } - - match: { hits.hits.0.fields.root\.subfield.0: 'child' } - - match: { hits.hits.0.fields.root\.subfield\.keyword.0: 'child' } - - is_false: hits.hits.0.fields.message - - match: { hits.hits.0._source.message.foo: 10 } - - match: { hits.hits.0._source.message.foo\.bar: 20 } - --- root with subobjects false and dynamic false: - requires: diff --git a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java index 5764e2631e037..a0c605b750bef 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java @@ -61,8 +61,7 @@ public class ObjectMapper extends Mapper { */ public enum Subobjects { ENABLED(Boolean.TRUE), - DISABLED(Boolean.FALSE), - AUTO("auto"); + DISABLED(Boolean.FALSE); private final Object printedValue; @@ -81,9 +80,6 @@ public static Subobjects from(Object node) { if (value.equalsIgnoreCase("false")) { return DISABLED; } - if (SUB_OBJECTS_AUTO_FEATURE_FLAG && value.equalsIgnoreCase("auto")) { - return AUTO; - } } throw new ElasticsearchParseException("unknown subobjects value: " + node); } @@ -202,9 +198,6 @@ public final void addDynamic(String name, String prefix, Mapper mapper, Document if (parentBuilder != null) { parentBuilder.addDynamic(name.substring(firstDotIndex + 1), immediateChildFullName, mapper, context); add(parentBuilder); - } else if (subobjects.value() == Subobjects.AUTO) { - // No matching parent object was found, the mapper is added as a leaf - similar to subobjects false. - add(name, mapper); } else { // Expected to find a matching parent object but got null. throw new IllegalStateException("Missing intermediate object " + immediateChildFullName); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java index 034924e72c7be..06f14c592bfd1 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DynamicTemplatesTests.java @@ -1403,262 +1403,6 @@ public void testMalformedDynamicMapping_v7() throws IOException { ); } - public void testSubobjectsAutoFlatPaths() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createDynamicTemplateAutoSubobjects(); - ParsedDocument doc = mapperService.documentMapper().parse(source(b -> { - b.field("foo.metric.count", 10); - b.field("foo.bar.baz", 10); - b.field("foo.metric.count.min", 4); - b.field("foo.metric.count.max", 15); - })); - merge(mapperService, dynamicMapping(doc.dynamicMappingsUpdate())); - assertNoSubobjects(mapperService); - } - - public void testSubobjectsAutoStructuredPaths() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createDynamicTemplateAutoSubobjects(); - ParsedDocument doc = mapperService.documentMapper().parse(source(b -> { - b.startObject("foo"); - { - b.startObject("metric"); - { - b.field("count", 10); - b.field("count.min", 4); - b.field("count.max", 15); - } - b.endObject(); - b.startObject("bar"); - b.field("baz", 10); - b.endObject(); - } - b.endObject(); - })); - merge(mapperService, dynamicMapping(doc.dynamicMappingsUpdate())); - assertNoSubobjects(mapperService); - } - - public void testSubobjectsAutoArrayOfObjects() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createDynamicTemplateAutoSubobjects(); - ParsedDocument doc = mapperService.documentMapper().parse(source(b -> { - b.startObject("foo"); - { - b.startArray("metric"); - { - b.startObject(); - { - b.field("count", 10); - b.field("count.min", 4); - b.field("count.max", 15); - } - b.endObject(); - b.startObject(); - { - b.field("count", 5); - b.field("count.min", 3); - b.field("count.max", 50); - } - b.endObject(); - } - b.endArray(); - b.startObject("bar"); - b.field("baz", 10); - b.endObject(); - } - b.endObject(); - })); - merge(mapperService, dynamicMapping(doc.dynamicMappingsUpdate())); - assertNoSubobjects(mapperService); - } - - public void testSubobjectAutoDynamicNested() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - DocumentMapper mapper = createDocumentMapper(topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - b.startObject("nested"); - { - b.field("match", "object"); - b.startObject("mapping"); - { - b.field("type", "nested"); - } - b.endObject(); - } - b.endObject(); - b.endObject(); - } - b.endArray(); - b.startObject("properties"); - b.startObject("metrics").field("type", "object").field("subobjects", "auto").endObject(); - b.endObject(); - })); - - ParsedDocument doc = mapper.parse(source(""" - { - "metrics.object" : { - "foo" : "bar" - } - } - """)); - - assertNotNull(doc.docs().get(0).get("metrics.object.foo")); - assertThat( - ((ObjectMapper) doc.dynamicMappingsUpdate().getRoot().getMapper("metrics")).getMapper("object"), - instanceOf(NestedObjectMapper.class) - ); - } - - public void testRootSubobjectAutoDynamicNested() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - DocumentMapper mapper = createDocumentMapper(topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - b.startObject("nested"); - { - b.field("match", "object"); - b.startObject("mapping"); - { - b.field("type", "nested"); - } - b.endObject(); - } - b.endObject(); - b.endObject(); - } - b.endArray(); - b.field("subobjects", "auto"); - })); - - ParsedDocument doc = mapper.parse(source(""" - { - "object" : { - "foo" : "bar" - } - } - """)); - - assertNotNull(doc.docs().get(0).get("object.foo")); - assertThat(doc.dynamicMappingsUpdate().getRoot().getMapper("object"), instanceOf(NestedObjectMapper.class)); - } - - public void testDynamicSubobjectsAutoDynamicFalse() throws Exception { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - // verify that we read the dynamic value properly from the parent mapper. DocumentParser#dynamicOrDefault splits the field - // name where dots are found, but it does that only for the parent prefix e.g. metrics.service and not for the leaf suffix time.max - DocumentMapper mapper = createDocumentMapper(topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - b.startObject("metrics"); - { - b.field("match", "metrics"); - b.startObject("mapping"); - { - b.field("type", "object"); - b.field("dynamic", "false"); - b.startObject("properties"); - { - b.startObject("service"); - { - b.field("type", "object"); - b.field("subobjects", "auto"); - b.startObject("properties"); - { - b.startObject("time"); - b.field("type", "keyword"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - b.endObject(); - } - b.endArray(); - })); - - ParsedDocument doc = mapper.parse(source(""" - { - "metrics": { - "service": { - "time" : 10, - "time.max" : 500 - } - } - } - """)); - - assertNotNull(doc.rootDoc().getField("metrics.service.time")); - assertNull(doc.rootDoc().getField("metrics.service.time.max")); - assertNotNull(doc.dynamicMappingsUpdate()); - ObjectMapper metrics = (ObjectMapper) doc.dynamicMappingsUpdate().getRoot().getMapper("metrics"); - assertEquals(ObjectMapper.Dynamic.FALSE, metrics.dynamic()); - assertEquals(1, metrics.mappers.size()); - ObjectMapper service = (ObjectMapper) metrics.getMapper("service"); - assertEquals(ObjectMapper.Subobjects.AUTO, service.subobjects()); - assertEquals(1, service.mappers.size()); - assertNotNull(service.getMapper("time")); - } - - public void testSubobjectsAutoWithInnerNestedFromDynamicTemplate() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - DocumentMapper mapper = createDocumentMapper(topMapping(b -> { - b.startArray("dynamic_templates"); - { - b.startObject(); - { - b.startObject("test"); - { - b.field("match", "metrics"); - b.startObject("mapping"); - { - b.field("type", "object").field("subobjects", "auto"); - b.startObject("properties"); - { - b.startObject("time"); - b.field("type", "nested"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - } - b.endArray(); - })); - - ParsedDocument doc = mapper.parse(source(""" - { - "metrics": { - "time" : { - "foo" : "bar" - }, - "time.max" : 500 - } - } - """)); - - assertNotNull(doc.rootDoc().get("metrics.time.max")); - assertNotNull(doc.docs().get(0).get("metrics.time.foo")); - assertThat( - ((ObjectMapper) doc.dynamicMappingsUpdate().getRoot().getMapper("metrics")).getMapper("time"), - instanceOf(NestedObjectMapper.class) - ); - } - public void testDynamicSubobject() throws IOException { MapperService mapperService = createMapperService(topMapping(b -> { b.startArray("dynamic_templates"); @@ -2078,54 +1822,6 @@ public void testSubobjectsFalseFlattened() throws IOException { assertEquals("flattened", fooStructuredMapper.typeName()); } - public void testSubobjectsAutoFlattened() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - String mapping = """ - { - "_doc": { - "properties": { - "attributes": { - "type": "object", - "subobjects": "auto" - } - }, - "dynamic_templates": [ - { - "test": { - "path_match": "attributes.resource.*", - "match_mapping_type": "object", - "mapping": { - "type": "flattened" - } - } - } - ] - } - } - """; - String docJson = """ - { - "attributes.resource": { - "complex.attribute": { - "a": "b" - }, - "foo.bar": "baz" - } - } - """; - - MapperService mapperService = createMapperService(mapping); - ParsedDocument parsedDoc = mapperService.documentMapper().parse(source(docJson)); - merge(mapperService, dynamicMapping(parsedDoc.dynamicMappingsUpdate())); - - Mapper fooBarMapper = mapperService.documentMapper().mappers().getMapper("attributes.resource.foo.bar"); - assertNotNull(fooBarMapper); - assertEquals("text", fooBarMapper.typeName()); - Mapper fooStructuredMapper = mapperService.documentMapper().mappers().getMapper("attributes.resource.complex.attribute"); - assertNotNull(fooStructuredMapper); - assertEquals("flattened", fooStructuredMapper.typeName()); - } - public void testMatchWithArrayOfFieldNames() throws IOException { String mapping = """ { diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java index 9e6f321513ed4..633117d202280 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/ObjectMapperTests.java @@ -22,7 +22,6 @@ import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.XContentFactory; import org.elasticsearch.xcontent.XContentType; -import org.hamcrest.core.IsInstanceOf; import java.io.IOException; import java.util.List; @@ -168,30 +167,6 @@ public void testMergeEnabledForIndexTemplates() throws IOException { assertFalse(objectMapper.isEnabled()); assertEquals(ObjectMapper.Subobjects.ENABLED, objectMapper.subobjects()); assertTrue(objectMapper.sourceKeepMode().isEmpty()); - - if (ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG) { - // Setting 'enabled' to true is allowed, and updates the mapping. - update = Strings.toString( - XContentFactory.jsonBuilder() - .startObject() - .startObject("properties") - .startObject("object") - .field("type", "object") - .field("enabled", true) - .field("subobjects", "auto") - .field(ObjectMapper.STORE_ARRAY_SOURCE_PARAM, true) - .endObject() - .endObject() - .endObject() - ); - mapper = mapperService.merge("type", new CompressedXContent(update), MergeReason.INDEX_TEMPLATE); - - objectMapper = mapper.mappers().objectMappers().get("object"); - assertNotNull(objectMapper); - assertTrue(objectMapper.isEnabled()); - assertEquals(ObjectMapper.Subobjects.AUTO, objectMapper.subobjects()); - assertEquals(Mapper.SourceKeepMode.ARRAYS, objectMapper.sourceKeepMode().orElse(Mapper.SourceKeepMode.NONE)); - } } public void testFieldReplacementForIndexTemplates() throws IOException { @@ -538,147 +513,6 @@ public void testSubobjectsCannotBeUpdatedOnRoot() throws IOException { assertEquals("the [subobjects] parameter can't be updated for the object mapping [_doc]", exception.getMessage()); } - public void testSubobjectsAuto() throws Exception { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mapping(b -> { - b.startObject("metrics.service"); - { - b.field("subobjects", "auto"); - b.startObject("properties"); - { - b.startObject("time"); - b.field("type", "long"); - b.endObject(); - b.startObject("time.max"); - b.field("type", "long"); - b.endObject(); - b.startObject("attributes"); - { - b.field("type", "object"); - b.field("enabled", "false"); - } - b.endObject(); - } - b.endObject(); - } - b.endObject(); - })); - assertNotNull(mapperService.fieldType("metrics.service.time")); - assertNotNull(mapperService.fieldType("metrics.service.time.max")); - assertNotNull(mapperService.documentMapper().mappers().objectMappers().get("metrics.service.attributes")); - } - - public void testSubobjectsAutoWithInnerObject() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mapping(b -> { - b.startObject("metrics.service"); - { - b.field("subobjects", "auto"); - b.startObject("properties"); - { - b.startObject("time"); - { - b.startObject("properties"); - { - b.startObject("max"); - b.field("type", "long"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - b.startObject("foo"); - b.field("type", "keyword"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - })); - assertNull(mapperService.fieldType("metrics.service.time")); - assertNotNull(mapperService.fieldType("metrics.service.time.max")); - assertNotNull(mapperService.fieldType("metrics.service.foo")); - assertNotNull(mapperService.documentMapper().mappers().objectMappers().get("metrics.service.time")); - assertNotNull(mapperService.documentMapper().mappers().getMapper("metrics.service.foo")); - } - - public void testSubobjectsAutoWithInnerNested() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mapping(b -> { - b.startObject("metrics.service"); - { - b.field("subobjects", "auto"); - b.startObject("properties"); - { - b.startObject("time"); - b.field("type", "nested"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - })); - assertThat( - mapperService.documentMapper().mappers().objectMappers().get("metrics.service.time"), - IsInstanceOf.instanceOf(NestedObjectMapper.class) - ); - } - - public void testSubobjectsAutoRoot() throws Exception { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mappingWithSubobjects(b -> { - b.startObject("metrics.service.time"); - b.field("type", "long"); - b.endObject(); - b.startObject("metrics.service.time.max"); - b.field("type", "long"); - b.endObject(); - b.startObject("metrics.attributes"); - { - b.field("type", "object"); - b.field("enabled", "false"); - } - b.endObject(); - }, "auto")); - assertNotNull(mapperService.fieldType("metrics.service.time")); - assertNotNull(mapperService.fieldType("metrics.service.time.max")); - assertNotNull(mapperService.documentMapper().mappers().objectMappers().get("metrics.attributes")); - } - - public void testSubobjectsAutoRootWithInnerObject() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mappingWithSubobjects(b -> { - b.startObject("metrics.service.time"); - { - b.startObject("properties"); - { - b.startObject("max"); - b.field("type", "long"); - b.endObject(); - } - b.endObject(); - } - b.endObject(); - }, "auto")); - assertNull(mapperService.fieldType("metrics.service.time")); - assertNotNull(mapperService.fieldType("metrics.service.time.max")); - assertNotNull(mapperService.documentMapper().mappers().objectMappers().get("metrics.service.time")); - assertNotNull(mapperService.documentMapper().mappers().getMapper("metrics.service.time.max")); - } - - public void testSubobjectsAutoRootWithInnerNested() throws IOException { - assumeTrue("only test when feature flag for subobjects auto is enabled", ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG); - MapperService mapperService = createMapperService(mappingWithSubobjects(b -> { - b.startObject("metrics.service"); - b.field("type", "nested"); - b.endObject(); - }, "auto")); - assertThat( - mapperService.documentMapper().mappers().objectMappers().get("metrics.service"), - IsInstanceOf.instanceOf(NestedObjectMapper.class) - ); - } - /** * Makes sure that an empty object mapper returns {@code null} from * {@link SourceLoader.SyntheticFieldLoader#docValuesLoader}. This @@ -788,15 +622,6 @@ public void testFlatten() { assertThat(fields, containsInAnyOrder("parent.keyword1", "parent.child.keyword2")); } - public void testFlattenSubobjectsAuto() { - MapperBuilderContext rootContext = MapperBuilderContext.root(false, false); - ObjectMapper objectMapper = new ObjectMapper.Builder("parent", Explicit.of(ObjectMapper.Subobjects.AUTO)).add( - new ObjectMapper.Builder("child").add(new KeywordFieldMapper.Builder("keyword2", IndexVersion.current())) - ).add(new KeywordFieldMapper.Builder("keyword1", IndexVersion.current())).build(rootContext); - List fields = objectMapper.asFlattenedFieldMappers(rootContext).stream().map(FieldMapper::fullPath).toList(); - assertThat(fields, containsInAnyOrder("parent.keyword1", "parent.child.keyword2")); - } - public void testFlattenSubobjectsFalse() { MapperBuilderContext rootContext = MapperBuilderContext.root(false, false); ObjectMapper objectMapper = new ObjectMapper.Builder("parent", Explicit.of(ObjectMapper.Subobjects.DISABLED)).add( diff --git a/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java index 70bb0061299a6..0d8eeb6a329d1 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/RootObjectMapperTests.java @@ -496,10 +496,7 @@ public void testSubobjectsWithRootObjectMapperNamespaceValidator() throws Except } }"""; - final String[] validSubojectsValues = ObjectMapper.SUB_OBJECTS_AUTO_FEATURE_FLAG - ? new String[] { "false", "true", "auto" } - : new String[] { "false", "true" }; - + final String[] validSubojectsValues = new String[] { "false", "true" }; { String json = withSubobjects.replace("", "false").replace("", "_project"); Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperServiceWithNamespaceValidator(json, validator)); diff --git a/test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java b/test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java index f3d0210bcceab..3fb817f6af681 100644 --- a/test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java +++ b/test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java @@ -27,6 +27,8 @@ import java.util.function.Supplier; import java.util.stream.Collectors; +import static org.elasticsearch.test.ESTestCase.randomFrom; + public class DefaultMappingParametersHandler implements DataSourceHandler { @Override public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceRequest.LeafMappingParametersGenerator request) { @@ -94,7 +96,7 @@ private Supplier> keywordMapping(DataSourceRequest.LeafMappi .collect(Collectors.toSet()); if (options.isEmpty() == false) { - mapping.put("copy_to", ESTestCase.randomFrom(options)); + mapping.put("copy_to", randomFrom(options)); } } @@ -113,7 +115,7 @@ private Supplier> scaledFloatMapping() { return () -> { var mapping = commonMappingParameters(); - mapping.put("scaling_factor", ESTestCase.randomFrom(10, 1000, 100000, 100.5)); + mapping.put("scaling_factor", randomFrom(10, 1000, 100000, 100.5)); if (ESTestCase.randomDouble() <= 0.2) { mapping.put("null_value", ESTestCase.randomDouble()); @@ -136,7 +138,7 @@ private Supplier> booleanMapping() { var mapping = commonMappingParameters(); if (ESTestCase.randomDouble() <= 0.2) { - mapping.put("null_value", ESTestCase.randomFrom(true, false, "true", "false")); + mapping.put("null_value", randomFrom(true, false, "true", "false")); } if (ESTestCase.randomBoolean()) { @@ -263,7 +265,7 @@ public static HashMap commonMappingParameters() { map.put("doc_values", ESTestCase.randomBoolean()); if (ESTestCase.randomBoolean()) { - map.put(Mapper.SYNTHETIC_SOURCE_KEEP_PARAM, ESTestCase.randomFrom("none", "arrays", "all")); + map.put(Mapper.SYNTHETIC_SOURCE_KEEP_PARAM, randomFrom("none", "arrays", "all")); } return map; @@ -278,7 +280,7 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ var parameters = new HashMap(); if (ESTestCase.randomBoolean()) { - parameters.put("dynamic", ESTestCase.randomFrom("true", "false", "strict")); + parameters.put("dynamic", randomFrom("true", "false", "strict")); } if (ESTestCase.randomBoolean()) { parameters.put(Mapper.SYNTHETIC_SOURCE_KEEP_PARAM, "all"); // [arrays] doesn't apply to nested objects @@ -295,11 +297,7 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ // 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. - var subobjects = ESTestCase.randomValueOtherThan( - ObjectMapper.Subobjects.AUTO, - () -> ESTestCase.randomFrom(ObjectMapper.Subobjects.values()) - ); - + var subobjects = randomFrom(ObjectMapper.Subobjects.values()); if (request.parentSubobjects() == ObjectMapper.Subobjects.DISABLED || subobjects == ObjectMapper.Subobjects.DISABLED) { // "enabled: false" is not compatible with subobjects: false // changing "dynamic" from parent context is not compatible with subobjects: false @@ -315,14 +313,14 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ parameters.put("subobjects", subobjects.toString()); } if (ESTestCase.randomBoolean()) { - parameters.put("dynamic", ESTestCase.randomFrom("true", "false", "strict", "runtime")); + parameters.put("dynamic", randomFrom("true", "false", "strict", "runtime")); } if (ESTestCase.randomBoolean()) { - parameters.put("enabled", ESTestCase.randomFrom("true", "false")); + parameters.put("enabled", randomFrom("true", "false")); } if (ESTestCase.randomBoolean()) { - var value = request.isRoot() ? ESTestCase.randomFrom("none", "arrays") : ESTestCase.randomFrom("none", "arrays", "all"); + var value = request.isRoot() ? randomFrom("none", "arrays") : randomFrom("none", "arrays", "all"); parameters.put(Mapper.SYNTHETIC_SOURCE_KEEP_PARAM, value); } diff --git a/x-pack/plugin/src/yamlRestTest/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java b/x-pack/plugin/src/yamlRestTest/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java index 2e7e8a6d31881..72df3d4494bf2 100644 --- a/x-pack/plugin/src/yamlRestTest/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java +++ b/x-pack/plugin/src/yamlRestTest/java/org/elasticsearch/xpack/test/rest/XPackRestIT.java @@ -45,7 +45,6 @@ public class XPackRestIT extends AbstractXPackRestTest { .setting("xpack.searchable.snapshot.shared_cache.region_size", "256KB") .user("x_pack_rest_user", "x-pack-test-password") .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .configFile("testnode.pem", Resource.fromClasspath("org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem")) .configFile("testnode.crt", Resource.fromClasspath("org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt")) .configFile("service_tokens", Resource.fromClasspath("service_tokens")) diff --git a/x-pack/qa/core-rest-tests-with-security/src/yamlRestTest/java/org/elasticsearch/xpack/security/CoreWithSecurityClientYamlTestSuiteIT.java b/x-pack/qa/core-rest-tests-with-security/src/yamlRestTest/java/org/elasticsearch/xpack/security/CoreWithSecurityClientYamlTestSuiteIT.java index e8113fde1d494..1b36d77d277c7 100644 --- a/x-pack/qa/core-rest-tests-with-security/src/yamlRestTest/java/org/elasticsearch/xpack/security/CoreWithSecurityClientYamlTestSuiteIT.java +++ b/x-pack/qa/core-rest-tests-with-security/src/yamlRestTest/java/org/elasticsearch/xpack/security/CoreWithSecurityClientYamlTestSuiteIT.java @@ -49,7 +49,6 @@ public class CoreWithSecurityClientYamlTestSuiteIT extends ESClientYamlSuiteTest .systemProperty("es.queryable_built_in_roles_enabled", "false") .user(USER, PASS) .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .feature(FeatureFlag.DOC_VALUES_SKIPPER) .feature(FeatureFlag.SYNTHETIC_VECTORS) .build(); diff --git a/x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/src/yamlRestTest/java/org/elasticsearch/multiproject/test/XpackWithMultipleProjectsClientYamlTestSuiteIT.java b/x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/src/yamlRestTest/java/org/elasticsearch/multiproject/test/XpackWithMultipleProjectsClientYamlTestSuiteIT.java index a5581ef922736..53453de3f9caa 100644 --- a/x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/src/yamlRestTest/java/org/elasticsearch/multiproject/test/XpackWithMultipleProjectsClientYamlTestSuiteIT.java +++ b/x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/src/yamlRestTest/java/org/elasticsearch/multiproject/test/XpackWithMultipleProjectsClientYamlTestSuiteIT.java @@ -49,7 +49,6 @@ public class XpackWithMultipleProjectsClientYamlTestSuiteIT extends MultipleProj .configFile("service_tokens", Resource.fromClasspath("service_tokens")) .user(USER, PASS) .feature(FeatureFlag.TIME_SERIES_MODE) - .feature(FeatureFlag.SUB_OBJECTS_AUTO_ENABLED) .systemProperty("es.queryable_built_in_roles_enabled", () -> { final String enabled = System.getProperty("es.queryable_built_in_roles_enabled"); return Objects.requireNonNullElse(enabled, ""); diff --git a/x-pack/qa/runtime-fields/build.gradle b/x-pack/qa/runtime-fields/build.gradle index 986baf867b501..43d6d9463e0d1 100644 --- a/x-pack/qa/runtime-fields/build.gradle +++ b/x-pack/qa/runtime-fields/build.gradle @@ -44,7 +44,6 @@ subprojects { setting 'xpack.security.enabled', 'false' requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0") - requiresFeature 'es.sub_objects_auto_feature_flag_enabled', Version.fromString("8.16.0") } tasks.named("yamlRestTest").configure {