diff --git a/server/src/main/java/org/opensearch/index/mapper/DerivedFieldValueFetcher.java b/server/src/main/java/org/opensearch/index/mapper/DerivedFieldValueFetcher.java index 1b4625ab7234b..09cdea882d10c 100644 --- a/server/src/main/java/org/opensearch/index/mapper/DerivedFieldValueFetcher.java +++ b/server/src/main/java/org/opensearch/index/mapper/DerivedFieldValueFetcher.java @@ -10,6 +10,7 @@ import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.LeafReaderContext; +import org.opensearch.common.annotation.DeprecatedApi; import org.opensearch.common.annotation.PublicApi; import org.opensearch.script.DerivedFieldScript; import org.opensearch.search.lookup.SourceLookup; @@ -28,7 +29,6 @@ public class DerivedFieldValueFetcher implements ValueFetcher { private DerivedFieldScript derivedFieldScript; private final DerivedFieldScript.LeafFactory derivedFieldScriptFactory; - private final Function valueForDisplay; public DerivedFieldValueFetcher(DerivedFieldScript.LeafFactory derivedFieldScriptFactory, Function valueForDisplay) { @@ -36,6 +36,16 @@ public DerivedFieldValueFetcher(DerivedFieldScript.LeafFactory derivedFieldScrip this.valueForDisplay = valueForDisplay; } + @DeprecatedApi(since = "2.15.0") + public DerivedFieldValueFetcher( + DerivedFieldScript.LeafFactory derivedFieldScriptFactory, + Function valueForDisplay, + Function indexableFieldFunction + ) { + this.derivedFieldScriptFactory = derivedFieldScriptFactory; + this.valueForDisplay = valueForDisplay; + } + @Override public List fetchValues(SourceLookup lookup) { List values = fetchValuesInternal(lookup); @@ -66,6 +76,14 @@ public List getIndexableField(SourceLookup lookup, Function getIndexableField(SourceLookup sourceLookup) { + throw new UnsupportedOperationException("Use getIndexableField(SourceLookup, Function) instead."); + } + @Override public void setNextReader(LeafReaderContext context) { try { diff --git a/server/src/main/java/org/opensearch/index/query/QueryShardContext.java b/server/src/main/java/org/opensearch/index/query/QueryShardContext.java index 91313092d8d28..05c07a0f32d5a 100644 --- a/server/src/main/java/org/opensearch/index/query/QueryShardContext.java +++ b/server/src/main/java/org/opensearch/index/query/QueryShardContext.java @@ -43,6 +43,7 @@ import org.opensearch.common.CheckedFunction; import org.opensearch.common.SetOnce; import org.opensearch.common.TriFunction; +import org.opensearch.common.annotation.DeprecatedApi; import org.opensearch.common.annotation.PublicApi; import org.opensearch.common.lucene.search.Queries; import org.opensearch.common.util.BigArrays; @@ -414,6 +415,16 @@ public void setDerivedFieldResolver(DerivedFieldResolver derivedFieldResolver) { this.derivedFieldResolver = derivedFieldResolver; } + @DeprecatedApi(since = "2.15.0") + public void setDerivedFieldTypes(Map derivedFieldTypeMap) { + throw new UnsupportedOperationException("Use setDerivedFieldResolver() instead."); + } + + @DeprecatedApi(since = "2.15.0") + public MappedFieldType getDerivedFieldType(String fieldName) { + throw new UnsupportedOperationException("Use resolveDerivedFieldType() instead."); + } + public void setAllowUnmappedFields(boolean allowUnmappedFields) { this.allowUnmappedFields = allowUnmappedFields; }