From f07c3ec1086c1152ccdd108375981ef51585dab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Thu, 19 Dec 2024 22:25:04 +0100 Subject: [PATCH] Restore GeoShapeWithDocValuesFieldMapperTests v7 test This test was removed with #112570 but needs to be added back with the read-only support for v7 indices. --- .../mapper/GeoShapeWithDocValuesFieldMapperTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java b/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java index 58fde288cfc60..5999a3ff1e151 100644 --- a/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java +++ b/x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/index/mapper/GeoShapeWithDocValuesFieldMapperTests.java @@ -91,6 +91,16 @@ public void testDefaultConfiguration() throws IOException { assertTrue(fieldType.hasDocValues()); } + public void testDefaultDocValueConfigurationOnPre7_8() throws IOException { + IndexVersion oldVersion = IndexVersionUtils.randomVersionBetween(random(), IndexVersions.V_7_0_0, IndexVersions.V_7_7_0); + DocumentMapper defaultMapper = createDocumentMapper(oldVersion, fieldMapping(this::minimalMapping)); + Mapper fieldMapper = defaultMapper.mappers().getMapper(FIELD_NAME); + assertThat(fieldMapper, instanceOf(fieldMapperClass())); + + GeoShapeWithDocValuesFieldMapper geoShapeFieldMapper = (GeoShapeWithDocValuesFieldMapper) fieldMapper; + assertFalse(geoShapeFieldMapper.fieldType().hasDocValues()); + } + /** * Test that orientation parameter correctly parses */