From 3887cb2e0e44de7f36bc97862c7dc123c889ee91 Mon Sep 17 00:00:00 2001 From: Rishabh Maurya Date: Fri, 5 Apr 2024 11:04:05 -0700 Subject: [PATCH] Fix failing test Signed-off-by: Rishabh Maurya --- .../org/opensearch/index/query/QueryShardContextTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/org/opensearch/index/query/QueryShardContextTests.java b/server/src/test/java/org/opensearch/index/query/QueryShardContextTests.java index 24e621910a560..6a7bf10835ddd 100644 --- a/server/src/test/java/org/opensearch/index/query/QueryShardContextTests.java +++ b/server/src/test/java/org/opensearch/index/query/QueryShardContextTests.java @@ -65,6 +65,7 @@ import org.opensearch.index.fielddata.ScriptDocValues; import org.opensearch.index.fielddata.plain.AbstractLeafOrdinalsFieldData; import org.opensearch.index.mapper.ContentPath; +import org.opensearch.index.mapper.DerivedField; import org.opensearch.index.mapper.DerivedFieldMapper; import org.opensearch.index.mapper.DocumentMapper; import org.opensearch.index.mapper.IndexFieldMapper; @@ -73,6 +74,7 @@ import org.opensearch.index.mapper.MapperService; import org.opensearch.index.mapper.MappingLookup; import org.opensearch.index.mapper.TextFieldMapper; +import org.opensearch.script.Script; import org.opensearch.search.lookup.LeafDocLookup; import org.opensearch.search.lookup.LeafSearchLookup; import org.opensearch.search.lookup.SearchLookup; @@ -132,7 +134,8 @@ public void testDerivedFieldMapping() { assertNull(context.failIfFieldMappingNotFound("test_derived", null)); DocumentMapper documentMapper = mock(DocumentMapper.class); Mapper.BuilderContext builderContext = new Mapper.BuilderContext(Settings.EMPTY, new ContentPath(0)); - DerivedFieldMapper derivedFieldMapper = new DerivedFieldMapper.Builder("test_derived").build(builderContext); + DerivedFieldMapper derivedFieldMapper = new DerivedFieldMapper.Builder(new DerivedField("test_derived", "keyword", new Script(""))) + .build(builderContext); MappingLookup mappingLookup = new MappingLookup( Collections.singletonList(derivedFieldMapper), Collections.emptyList(),