|
35 | 35 | import org.opensearch.cluster.metadata.IndexMetadata;
|
36 | 36 | import org.opensearch.common.compress.CompressedXContent;
|
37 | 37 | import org.opensearch.common.settings.Settings;
|
| 38 | +import org.opensearch.common.util.FeatureFlags; |
38 | 39 | import org.opensearch.common.xcontent.XContentFactory;
|
39 | 40 | import org.opensearch.core.common.bytes.BytesArray;
|
40 | 41 | import org.opensearch.core.common.unit.ByteSizeUnit;
|
@@ -498,7 +499,6 @@ public void testDerivedFields() throws Exception {
|
498 | 499 | assertEquals("date", mapper.typeName());
|
499 | 500 | }
|
500 | 501 |
|
501 |
| - @LockFeatureFlag(STAR_TREE_INDEX) |
502 | 502 | public void testCompositeFields() throws Exception {
|
503 | 503 | String mapping = XContentFactory.jsonBuilder()
|
504 | 504 | .startObject()
|
@@ -556,18 +556,20 @@ public void testCompositeFields() throws Exception {
|
556 | 556 | ex.getMessage()
|
557 | 557 | );
|
558 | 558 |
|
559 |
| - DocumentMapper documentMapper = createIndex("test", settings).mapperService() |
560 |
| - .documentMapperParser() |
561 |
| - .parse("tweet", new CompressedXContent(mapping)); |
562 |
| - |
563 |
| - Mapper mapper = documentMapper.root().getMapper("startree"); |
564 |
| - assertTrue(mapper instanceof StarTreeMapper); |
565 |
| - StarTreeMapper starTreeMapper = (StarTreeMapper) mapper; |
566 |
| - assertEquals("star_tree", starTreeMapper.fieldType().typeName()); |
567 |
| - // Check that field in properties was parsed correctly as well |
568 |
| - mapper = documentMapper.root().getMapper("@timestamp"); |
569 |
| - assertNotNull(mapper); |
570 |
| - assertEquals("date", mapper.typeName()); |
| 559 | + FeatureFlags.TestUtils.with(STAR_TREE_INDEX, () -> { |
| 560 | + DocumentMapper documentMapper = createIndex("test", settings).mapperService() |
| 561 | + .documentMapperParser() |
| 562 | + .parse("tweet", new CompressedXContent(mapping)); |
| 563 | + |
| 564 | + Mapper mapper = documentMapper.root().getMapper("startree"); |
| 565 | + assertTrue(mapper instanceof StarTreeMapper); |
| 566 | + StarTreeMapper starTreeMapper = (StarTreeMapper) mapper; |
| 567 | + assertEquals("star_tree", starTreeMapper.fieldType().typeName()); |
| 568 | + // Check that field in properties was parsed correctly as well |
| 569 | + mapper = documentMapper.root().getMapper("@timestamp"); |
| 570 | + assertNotNull(mapper); |
| 571 | + assertEquals("date", mapper.typeName()); |
| 572 | + }); |
571 | 573 | }
|
572 | 574 |
|
573 | 575 | public void testNestedIsParent() throws Exception {
|
|
0 commit comments