Skip to content

Commit

Permalink
Revert "Provide the NestedScope in Mapper#syntheticFieldLoader"
Browse files Browse the repository at this point in the history
This reverts commit 618ab79.
  • Loading branch information
jimczi committed May 30, 2024
1 parent 65850a0 commit 79f12f6
Show file tree
Hide file tree
Showing 47 changed files with 53 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.field.TextDocValuesField;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.lookup.SourceProvider;
Expand Down Expand Up @@ -434,7 +433,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (copyTo.copyToFields().isEmpty() != true) {
throw new IllegalArgumentException(
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;

import java.util.Collections;

Expand Down Expand Up @@ -78,7 +77,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.elasticsearch.index.mapper.TimeSeriesParams;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.field.DocValuesScriptFieldFactory;
import org.elasticsearch.script.field.ScaledFloatDocValuesField;
import org.elasticsearch.script.field.ToScriptFieldFactory;
Expand Down Expand Up @@ -700,7 +699,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasDocValues == false) {
throw new IllegalArgumentException(
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it doesn't have doc values"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.elasticsearch.index.mapper.TextFieldMapper;
import org.elasticsearch.index.mapper.TextParams;
import org.elasticsearch.index.mapper.TextSearchInfo;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.index.similarity.SimilarityProvider;
import org.elasticsearch.xcontent.XContentBuilder;

Expand Down Expand Up @@ -578,7 +577,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (copyTo.copyToFields().isEmpty() != true) {
throw new IllegalArgumentException(
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.elasticsearch.index.mapper.SourceLoader;
import org.elasticsearch.index.mapper.ValueFetcher;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;

import java.util.Collections;

Expand Down Expand Up @@ -100,7 +99,7 @@ public FieldMapper.Builder getMergeBuilder() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.QueryRewriteContext;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.IndicesService;
Expand Down Expand Up @@ -846,7 +845,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return new StringStoredFieldFieldLoader(name(), simpleName(), null) {
@Override
protected void write(XContentBuilder b, Object value) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.plain.BytesBinaryIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down Expand Up @@ -207,7 +206,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (copyTo.copyToFields().isEmpty() != true) {
throw new IllegalArgumentException(
"field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source because it declares copy_to"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.elasticsearch.index.fielddata.SourceValueFetcherSortedBooleanIndexFieldData;
import org.elasticsearch.index.fielddata.plain.SortedNumericIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.BooleanFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptCompiler;
Expand Down Expand Up @@ -493,7 +492,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasScript()) {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.elasticsearch.index.TimestampBounds;
import org.elasticsearch.index.mapper.DateFieldMapper.Resolution;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentType;

Expand Down Expand Up @@ -271,7 +270,7 @@ public boolean isEnabled() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.elasticsearch.index.query.DateRangeIncludingNowQuery;
import org.elasticsearch.index.query.QueryRewriteContext;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.DateFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptCompiler;
Expand Down Expand Up @@ -968,7 +967,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasScript) {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.common.xcontent.XContentParserUtils;
import org.elasticsearch.index.query.QueryShardException;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentParser;

Expand Down Expand Up @@ -129,7 +128,7 @@ public static IndexableField field(int count) {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return new SyntheticFieldLoader();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.xcontent.XContentBuilder;

import java.io.IOException;
Expand Down Expand Up @@ -158,7 +157,7 @@ public FieldAliasMapper build(MapperBuilderContext context) {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptType;
import org.elasticsearch.search.lookup.SearchLookup;
Expand Down Expand Up @@ -470,12 +469,12 @@ protected SyntheticSourceMode syntheticSourceMode() {
/**
* Mappers override this method with native synthetic source support.
* If mapper does not support synthetic source, it is generated using generic implementation
* in {@link DocumentParser#parseObjectOrField} and {@link Mapper#syntheticFieldLoader(NestedScope)}.
* in {@link DocumentParser#parseObjectOrField} and {@link ObjectMapper#syntheticFieldLoader()}.
*
* @return implementation of {@link SourceLoader.SyntheticFieldLoader}
*/
@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
// If mapper supports synthetic source natively, it overrides this method,
// /so we won't see those here.
if (syntheticSourceMode() == SyntheticSourceMode.FALLBACK) {
Expand All @@ -488,7 +487,7 @@ public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nested
return SourceLoader.SyntheticFieldLoader.NOTHING;
}

return super.syntheticFieldLoader(nestedScope);
return super.syntheticFieldLoader();
}

public static final class MultiFields implements Iterable<FieldMapper>, ToXContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;

import java.util.Collections;

Expand Down Expand Up @@ -190,7 +189,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.elasticsearch.index.fielddata.SourceValueFetcherMultiGeoPointIndexFieldData;
import org.elasticsearch.index.fielddata.plain.LatLonPointIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.GeoPointFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptCompiler;
Expand Down Expand Up @@ -577,7 +576,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasScript()) {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;

import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -52,7 +51,7 @@ protected final String contentType() {
}

@Override
public final SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public final SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.plain.SortedSetOrdinalsIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.field.KeywordDocValuesField;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;

Expand Down Expand Up @@ -143,7 +142,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData;
import org.elasticsearch.index.query.QueryRewriteContext;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.field.DelegateDocValuesField;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.fetch.StoredFieldsSpec;
Expand Down Expand Up @@ -114,7 +113,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.plain.SortedSetOrdinalsIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.script.IpFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptCompiler;
Expand Down Expand Up @@ -608,7 +607,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
if (hasScript()) {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.elasticsearch.index.fielddata.StoredFieldSortedBinaryIndexFieldData;
import org.elasticsearch.index.fielddata.plain.SortedSetOrdinalsIndexFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.index.similarity.SimilarityProvider;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptCompiler;
Expand Down Expand Up @@ -1028,7 +1027,7 @@ protected SyntheticSourceMode syntheticSourceMode() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return syntheticFieldLoader(simpleName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.index.query.support.NestedScope;

import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -108,7 +107,7 @@ protected String contentType() {
}

@Override
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
return SourceLoader.SyntheticFieldLoader.NOTHING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.common.util.StringLiteralDeduplicator;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.query.support.NestedScope;
import org.elasticsearch.xcontent.ToXContentFragment;

import java.util.Map;
Expand Down Expand Up @@ -98,7 +97,7 @@ public final String simpleName() {
* users configure synthetic source in the mapping without configuring all
* fields properly.
*/
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader(NestedScope nestedScope) {
public SourceLoader.SyntheticFieldLoader syntheticFieldLoader() {
throw new IllegalArgumentException("field [" + name() + "] of type [" + typeName() + "] doesn't support synthetic source");
}

Expand Down
Loading

0 comments on commit 79f12f6

Please sign in to comment.