Remove MapperService argument from IndexFieldData.Builder#build (#63197) (#63311)

MapperService carries a lot of weight and is only used to determine if loading of field data for the id field is enabled, which can be done in a different way.
This commit is contained in:
Luca Cavanna 2020-10-06 15:04:23 +02:00 committed by GitHub
parent 7969fbb4ab
commit ca68298e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 165 additions and 110 deletions

View File

@ -211,11 +211,11 @@ public class ScaledFloatFieldMapper extends ParametrizedFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
failIfNoDocValues();
return (cache, breakerService, mapperService) -> {
return (cache, breakerService) -> {
final IndexNumericFieldData scaledValues = new SortedNumericIndexFieldData.Builder(
name(),
IndexNumericFieldData.NumericType.LONG
).build(cache, breakerService, mapperService);
).build(cache, breakerService);
return new ScaledFloatIndexFieldData(scaledValues, scalingFactor);
};
}

View File

@ -155,7 +155,7 @@ public class ScaledFloatFieldTypeTests extends FieldTypeTestCase {
= new ScaledFloatFieldMapper.ScaledFloatFieldType("scaled_float1", scalingFactor);
IndexNumericFieldData fielddata = (IndexNumericFieldData) f1.fielddataBuilder("index", () -> {
throw new UnsupportedOperationException();
}).build(null, null, null);
}).build(null, null);
assertEquals(fielddata.getNumericType(), IndexNumericFieldData.NumericType.DOUBLE);
LeafNumericFieldData leafFieldData = fielddata.load(reader.leaves().get(0));
SortedNumericDoubleValues values = leafFieldData.getDoubleValues();
@ -168,7 +168,7 @@ public class ScaledFloatFieldTypeTests extends FieldTypeTestCase {
= new ScaledFloatFieldMapper.ScaledFloatFieldType("scaled_float2", scalingFactor);
fielddata = (IndexNumericFieldData) f2.fielddataBuilder("index", () -> {
throw new UnsupportedOperationException();
}).build(null, null, null);
}).build(null, null);
leafFieldData = fielddata.load(reader.leaves().get(0));
values = leafFieldData.getDoubleValues();
assertTrue(values.advanceExact(0));

View File

@ -729,7 +729,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
shardContext::lookup);
IndexFieldDataCache cache = new IndexFieldDataCache.None();
CircuitBreakerService circuitBreaker = new NoneCircuitBreakerService();
return (IFD) builder.build(cache, circuitBreaker, shardContext.getMapperService());
return (IFD) builder.build(cache, circuitBreaker);
}
};
}

View File

@ -37,7 +37,6 @@ import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -246,7 +245,7 @@ public interface IndexFieldData<FD extends LeafFieldData> {
interface Builder {
IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService);
IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService);
}
interface Global<FD extends LeafFieldData> extends IndexFieldData<FD> {

View File

@ -135,7 +135,7 @@ public class IndexFieldDataService extends AbstractIndexComponent implements Clo
}
}
return (IFD) builder.build(cache, circuitBreakerService, mapperService);
return (IFD) builder.build(cache, circuitBreakerService);
}
/**

View File

@ -31,7 +31,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.N
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexGeoPointFieldData;
import org.elasticsearch.index.fielddata.LeafGeoPointFieldData;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -113,7 +112,7 @@ public abstract class AbstractLatLonPointIndexFieldData implements IndexGeoPoint
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
// ignore breaker
return new LatLonPointIndexFieldData(name, valuesSourceType);
}

View File

@ -27,7 +27,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -47,7 +46,7 @@ public class BinaryIndexFieldData implements IndexFieldData<BinaryDVLeafFieldDat
}
@Override
public BinaryIndexFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public BinaryIndexFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new BinaryIndexFieldData(name, valuesSourceType);
}
}

View File

@ -27,7 +27,6 @@ import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -92,7 +91,7 @@ public class BytesBinaryIndexFieldData implements IndexFieldData<BytesBinaryDVLe
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
// Ignore breaker
return new BytesBinaryIndexFieldData(name, valuesSourceType);
}

View File

@ -36,7 +36,6 @@ import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData;
import org.elasticsearch.index.fielddata.LeafOrdinalsFieldData;
import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -44,30 +43,27 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceType;
import org.elasticsearch.search.sort.BucketedSort;
import org.elasticsearch.search.sort.SortOrder;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
public static class Builder implements IndexFieldData.Builder {
private final Function<MapperService, String> valueFunction;
private final String constantValue;
private final String name;
private final ValuesSourceType valuesSourceType;
public Builder(Function<MapperService, String> valueFunction, String name, ValuesSourceType valuesSourceType) {
this.valueFunction = valueFunction;
public Builder(String constantValue, String name, ValuesSourceType valuesSourceType) {
this.constantValue = constantValue;
this.name = name;
this.valuesSourceType = valuesSourceType;
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
return new ConstantIndexFieldData(name, valueFunction.apply(mapperService), valuesSourceType);
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new ConstantIndexFieldData(name, constantValue, valuesSourceType);
}
}
private static class ConstantLeafFieldData extends AbstractLeafOrdinalsFieldData {
@ -116,7 +112,7 @@ public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
}
@Override
public boolean advanceExact(int target) throws IOException {
public boolean advanceExact(int target) {
docID = target;
return true;
}
@ -126,7 +122,7 @@ public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
return docID;
}
};
return (SortedSetDocValues) DocValues.singleton(sortedValues);
return DocValues.singleton(sortedValues);
}
@Override
@ -148,8 +144,7 @@ public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
}
@Override
public LeafOrdinalsFieldData loadDirect(LeafReaderContext context)
throws Exception {
public LeafOrdinalsFieldData loadDirect(LeafReaderContext context) {
return atomicFieldData;
}
@ -172,7 +167,7 @@ public class ConstantIndexFieldData extends AbstractIndexOrdinalsFieldData {
}
@Override
public IndexOrdinalsFieldData loadGlobalDirect(DirectoryReader indexReader) throws Exception {
public IndexOrdinalsFieldData loadGlobalDirect(DirectoryReader indexReader) {
return loadGlobal(indexReader);
}

View File

@ -46,7 +46,6 @@ import org.elasticsearch.index.fielddata.RamAccountingTermsEnum;
import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
import org.elasticsearch.index.fielddata.ordinals.OrdinalsBuilder;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -77,7 +76,7 @@ public class PagedBytesIndexFieldData extends AbstractIndexOrdinalsFieldData {
}
@Override
public IndexOrdinalsFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexOrdinalsFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new PagedBytesIndexFieldData(name, valuesSourceType, cache, breakerService,
minFrequency, maxFrequency, minSegmentSize);
}

View File

@ -39,7 +39,6 @@ import org.elasticsearch.index.fielddata.NumericDoubleValues;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
import org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource;
import org.elasticsearch.index.mapper.DocValueFetcher;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -67,8 +66,7 @@ public class SortedNumericIndexFieldData extends IndexNumericFieldData {
@Override
public SortedNumericIndexFieldData build(
IndexFieldDataCache cache,
CircuitBreakerService breakerService,
MapperService mapperService
CircuitBreakerService breakerService
) {
return new SortedNumericIndexFieldData(name, numericType);
}

View File

@ -33,7 +33,6 @@ import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.LeafOrdinalsFieldData;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -63,8 +62,7 @@ public class SortedSetOrdinalsIndexFieldData extends AbstractIndexOrdinalsFieldD
@Override
public SortedSetOrdinalsIndexFieldData build(
IndexFieldDataCache cache,
CircuitBreakerService breakerService,
MapperService mapperService
CircuitBreakerService breakerService
) {
return new SortedSetOrdinalsIndexFieldData(cache, name, valuesSourceType, breakerService, scriptFunction);
}

View File

@ -95,14 +95,15 @@ public class IdFieldMapper extends MetadataFieldMapper {
}
}
public static final TypeParser PARSER = new FixedTypeParser(c -> new IdFieldMapper());
public static final TypeParser PARSER = new FixedTypeParser(c -> new IdFieldMapper(() -> c.mapperService().isIdFieldDataEnabled()));
static final class IdFieldType extends TermBasedFieldType {
public static final IdFieldType INSTANCE = new IdFieldType();
private final Supplier<Boolean> fieldDataEnabled;
private IdFieldType() {
IdFieldType(Supplier<Boolean> fieldDataEnabled) {
super(NAME, true, true, false, TextSearchInfo.SIMPLE_MATCH_ONLY, Collections.emptyMap());
this.fieldDataEnabled = fieldDataEnabled;
setIndexAnalyzer(Lucene.KEYWORD_ANALYZER);
}
@ -148,6 +149,11 @@ public class IdFieldMapper extends MetadataFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
if (fieldDataEnabled.get() == false) {
throw new IllegalArgumentException("Fielddata access on the _id field is disallowed, "
+ "you can re-enable it by updating the dynamic cluster setting: "
+ IndicesService.INDICES_ID_FIELD_DATA_ENABLED_SETTING.getKey());
}
final IndexFieldData.Builder fieldDataBuilder = new PagedBytesIndexFieldData.Builder(
name(),
TextFieldMapper.Defaults.FIELDDATA_MIN_FREQUENCY,
@ -158,16 +164,10 @@ public class IdFieldMapper extends MetadataFieldMapper {
@Override
public IndexFieldData<?> build(
IndexFieldDataCache cache,
CircuitBreakerService breakerService,
MapperService mapperService
CircuitBreakerService breakerService
) {
if (mapperService.isIdFieldDataEnabled() == false) {
throw new IllegalArgumentException("Fielddata access on the _id field is disallowed, "
+ "you can re-enable it by updating the dynamic cluster setting: "
+ IndicesService.INDICES_ID_FIELD_DATA_ENABLED_SETTING.getKey());
}
deprecationLogger.deprecate("id_field_data", ID_FIELD_DATA_DEPRECATION_MESSAGE);
final IndexFieldData<?> fieldData = fieldDataBuilder.build(cache, breakerService, mapperService);
final IndexFieldData<?> fieldData = fieldDataBuilder.build(cache, breakerService);
return new IndexFieldData<LeafFieldData>() {
@Override
public String getFieldName() {
@ -255,12 +255,12 @@ public class IdFieldMapper extends MetadataFieldMapper {
};
}
private IdFieldMapper() {
super(new IdFieldType());
private IdFieldMapper(Supplier<Boolean> fieldDataEnabled) {
super(new IdFieldType(fieldDataEnabled));
}
@Override
public void preParse(ParseContext context) throws IOException {
public void preParse(ParseContext context) {
BytesRef id = Uid.encodeId(context.sourceToParse().id());
context.doc().add(new Field(NAME, id, Defaults.FIELD_TYPE));
}
@ -269,5 +269,4 @@ public class IdFieldMapper extends MetadataFieldMapper {
protected String contentType() {
return CONTENT_TYPE;
}
}

View File

@ -69,7 +69,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
return new ConstantIndexFieldData.Builder(mapperService -> fullyQualifiedIndexName, name(), CoreValuesSourceType.BYTES);
return new ConstantIndexFieldData.Builder(fullyQualifiedIndexName, name(), CoreValuesSourceType.BYTES);
}
@Override

View File

@ -39,7 +39,6 @@ import org.elasticsearch.search.lookup.SearchLookup;
import java.time.ZoneId;
import java.util.Collections;
import java.util.function.Function;
import java.util.function.Supplier;
public class TypeFieldMapper extends MetadataFieldMapper {
@ -89,8 +88,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
emitTypesDeprecationWarning();
Function<MapperService, String> typeFunction = mapperService -> mapperService.documentMapper().type();
return new ConstantIndexFieldData.Builder(typeFunction, name(), CoreValuesSourceType.BYTES);
return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.BYTES);
}
@Override

View File

@ -0,0 +1,84 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.index.mapper;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.lookup.SearchLookup;
import java.util.Collections;
import java.util.function.Supplier;
/**
* Mediates access to the deprecated _type field
*/
public final class TypeFieldType extends ConstantFieldType {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TypeFieldType.class);
public static final String TYPES_V7_DEPRECATION_MESSAGE = "[types removal] Using the _type field " +
"in queries and aggregations is deprecated, prefer to use a field instead.";
public static final String NAME = "_type";
public static final String CONTENT_TYPE = "_type";
private final String type;
TypeFieldType(String type) {
super(NAME, Collections.emptyMap());
this.type = type;
}
@Override
public String typeName() {
return CONTENT_TYPE;
}
@Override
public Query existsQuery(QueryShardContext context) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
return new MatchAllDocsQuery();
}
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
return new ConstantIndexFieldData.Builder(type, name(), CoreValuesSourceType.BYTES);
}
@Override
public ValueFetcher valueFetcher(MapperService mapperService, SearchLookup searchLookup, String format) {
throw new UnsupportedOperationException("Cannot fetch values for internal field [" + name() + "].");
}
@Override
protected boolean matches(String pattern, boolean caseInsensitive, QueryShardContext context) {
deprecationLogger.deprecate("typefieldtype", TYPES_V7_DEPRECATION_MESSAGE);
if (caseInsensitive) {
return pattern.equalsIgnoreCase(type);
}
return pattern.equals(type);
}
}

View File

@ -126,7 +126,7 @@ public class IndexFieldDataServiceTests extends ESSingleNodeTestCase {
@SuppressWarnings("unchecked")
Supplier<SearchLookup> searchLookup = (Supplier<SearchLookup>)invocationOnMock.getArguments()[1];
searchLookupSetOnce.set(searchLookup);
return (IndexFieldData.Builder) (cache, breakerService, mapperService) -> null;
return (IndexFieldData.Builder) (cache, breakerService) -> null;
});
SearchLookup searchLookup = new SearchLookup(null, null, null);
ifdService.getForField(ft, "qualified", () -> searchLookup);

View File

@ -85,7 +85,7 @@ public class IdFieldMapperTests extends ESSingleNodeTestCase {
ft.fielddataBuilder("test", () -> {
throw new UnsupportedOperationException();
}).build(null, null, mapperService);
}).build(null, null);
assertWarnings(ID_FIELD_DATA_DEPRECATION_MESSAGE);
client().admin().cluster().prepareUpdateSettings()
@ -95,7 +95,7 @@ public class IdFieldMapperTests extends ESSingleNodeTestCase {
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class,
() -> ft.fielddataBuilder("test", () -> {
throw new UnsupportedOperationException();
}).build(null, null, mapperService));
}).build(null, null));
assertThat(exc.getMessage(), containsString(IndicesService.INDICES_ID_FIELD_DATA_ENABLED_SETTING.getKey()));
} finally {
// unset cluster setting
@ -104,5 +104,4 @@ public class IdFieldMapperTests extends ESSingleNodeTestCase {
.get();
}
}
}

View File

@ -35,13 +35,13 @@ import java.util.Collections;
public class IdFieldTypeTests extends ESTestCase {
public void testRangeQuery() {
MappedFieldType ft = IdFieldMapper.IdFieldType.INSTANCE;
MappedFieldType ft = new IdFieldMapper.IdFieldType(() -> false);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
() -> ft.rangeQuery(null, null, randomBoolean(), randomBoolean(), null, null, null, null));
assertEquals("Field [_id] of type [_id] does not support range queries", e.getMessage());
}
public void testTermsQuery() throws Exception {
public void testTermsQuery() {
QueryShardContext context = Mockito.mock(QueryShardContext.class);
Settings indexSettings = Settings.builder()
.put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)
@ -58,7 +58,7 @@ public class IdFieldTypeTests extends ESTestCase {
Mockito.when(context.queryTypes()).thenReturn(types);
Mockito.when(context.getMapperService()).thenReturn(mapperService);
MappedFieldType ft = IdFieldMapper.IdFieldType.INSTANCE;
MappedFieldType ft = new IdFieldMapper.IdFieldType(() -> false);
Query query = ft.termQuery("id", context);
assertEquals(new TermInSetQuery("_id", Uid.encodeId("id")), query);

View File

@ -455,7 +455,7 @@ public class NumberFieldTypeTests extends FieldTypeTestCase {
NumberFieldType fieldType = new NumberFieldType("field", type);
IndexNumericFieldData fielddata = (IndexNumericFieldData) fieldType.fielddataBuilder("index", () -> {
throw new UnsupportedOperationException();
}).build(null, null, null);
}).build(null, null);
SortField sortField = fielddata.sortField(null, MultiValueMode.MIN, null, randomBoolean());
IndexWriterConfig writerConfig = new IndexWriterConfig();

View File

@ -71,7 +71,7 @@ public class TypeFieldMapperTests extends ESSingleNodeTestCase {
MappedFieldType ft = mapperService.fieldType(TypeFieldMapper.NAME);
IndexOrdinalsFieldData fd = (IndexOrdinalsFieldData) ft.fielddataBuilder("test", () -> {
throw new UnsupportedOperationException();
}).build(new IndexFieldDataCache.None(), new NoneCircuitBreakerService(), mapperService);
}).build(new IndexFieldDataCache.None(), new NoneCircuitBreakerService());
LeafOrdinalsFieldData afd = fd.load(r.leaves().get(0));
SortedSetDocValues values = afd.getOrdinalsValues();
assertTrue(values.advanceExact(0));

View File

@ -302,7 +302,7 @@ public class QueryShardContextTests extends ESTestCase {
final long nowInMillis = randomNonNegativeLong();
return new QueryShardContext(
0, indexSettings, BigArrays.NON_RECYCLING_INSTANCE, null,
(mappedFieldType, idxName, searchLookup) -> mappedFieldType.fielddataBuilder(idxName, searchLookup).build(null, null, null),
(mappedFieldType, idxName, searchLookup) -> mappedFieldType.fielddataBuilder(idxName, searchLookup).build(null, null),
mapperService, null, null, NamedXContentRegistry.EMPTY, new NamedWriteableRegistry(Collections.emptyList()),
null, null, () -> nowInMillis, clusterAlias, null, () -> true, null);
}
@ -342,7 +342,7 @@ public class QueryShardContextTests extends ESTestCase {
return leafFieldData;
});
IndexFieldData.Builder builder = mock(IndexFieldData.Builder.class);
when(builder.build(any(), any(), any())).thenAnswer(buildInv -> indexFieldData);
when(builder.build(any(), any())).thenAnswer(buildInv -> indexFieldData);
return builder;
});
return fieldType;

View File

@ -199,7 +199,7 @@ public abstract class AbstractSortTestCase<T extends SortBuilder<T>> extends EST
TriFunction<MappedFieldType, String, Supplier<SearchLookup>, IndexFieldData<?>> indexFieldDataLookup =
(fieldType, fieldIndexName, searchLookup) -> {
IndexFieldData.Builder builder = fieldType.fielddataBuilder(fieldIndexName, searchLookup);
return builder.build(new IndexFieldDataCache.None(), null, null);
return builder.build(new IndexFieldDataCache.None(), null);
};
return new QueryShardContext(0, idxSettings, BigArrays.NON_RECYCLING_INSTANCE, bitsetFilterCache, indexFieldDataLookup,
null, null, scriptService, xContentRegistry(), namedWriteableRegistry, null, searcher,

View File

@ -272,7 +272,7 @@ public abstract class MapperTestCase extends MapperServiceTestCase {
.fielddataBuilder("test", () -> {
throw new UnsupportedOperationException();
})
.build(new IndexFieldDataCache.None(), new NoneCircuitBreakerService(), mapperService);
.build(new IndexFieldDataCache.None(), new NoneCircuitBreakerService());
SetOnce<List<?>> result = new SetOnce<>();
withLuceneIndex(mapperService, iw -> {
iw.addDocument(mapperService.documentMapper().parse(source(b -> b.field(ft.name(), sourceValue))).rootDoc());

View File

@ -388,7 +388,7 @@ public abstract class AggregatorTestCase extends ESTestCase {
MapperService mapperService, CircuitBreakerService circuitBreakerService) {
return (fieldType, s, searchLookup) -> fieldType.fielddataBuilder(
mapperService.getIndexSettings().getIndex().getName(), searchLookup)
.build(new IndexFieldDataCache.None(), circuitBreakerService, mapperService);
.build(new IndexFieldDataCache.None(), circuitBreakerService);
}
/**
@ -712,7 +712,7 @@ public abstract class AggregatorTestCase extends ESTestCase {
private ValuesSourceType fieldToVST(MappedFieldType fieldType) {
return fieldType.fielddataBuilder("", () -> {
throw new UnsupportedOperationException();
}).build(null, null, null).getValuesSourceType();
}).build(null, null).getValuesSourceType();
}
/**

View File

@ -152,7 +152,7 @@ public class HistogramFieldMapper extends ParametrizedFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
failIfNoDocValues();
return (cache, breakerService, mapperService) -> new IndexHistogramFieldData(name(), AnalyticsValuesSourceType.HISTOGRAM) {
return (cache, breakerService) -> new IndexHistogramFieldData(name(), AnalyticsValuesSourceType.HISTOGRAM) {
@Override
public LeafHistogramFieldData load(LeafReaderContext context) {

View File

@ -128,7 +128,7 @@ public class ConstantKeywordFieldMapper extends ParametrizedFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
return new ConstantIndexFieldData.Builder(mapperService -> value, name(), CoreValuesSourceType.BYTES);
return new ConstantIndexFieldData.Builder(value, name(), CoreValuesSourceType.BYTES);
}
@Override

View File

@ -429,7 +429,7 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
IndexOrdinalsFieldData delegate = new SortedSetOrdinalsIndexFieldData(
cache, fieldName, valuesSourceType, breakerService, AbstractLeafOrdinalsFieldData.DEFAULT_SCRIPT_FUNCTION);
return new KeyedFlatObjectFieldData(key, delegate);

View File

@ -220,11 +220,11 @@ public class UnsignedLongFieldMapper extends ParametrizedFieldMapper {
@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
failIfNoDocValues();
return (cache, breakerService, mapperService) -> {
return (cache, breakerService) -> {
final IndexNumericFieldData signedLongValues = new SortedNumericIndexFieldData.Builder(
name(),
IndexNumericFieldData.NumericType.LONG
).build(cache, breakerService, mapperService);
).build(cache, breakerService);
return new UnsignedLongIndexFieldData(signedLongValues);
};
}

View File

@ -13,7 +13,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.plain.LeafLongFieldData;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -31,7 +30,7 @@ public final class BooleanScriptFieldData extends IndexNumericFieldData {
}
@Override
public BooleanScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public BooleanScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new BooleanScriptFieldData(name, leafFactory);
}
}

View File

@ -13,7 +13,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.plain.LeafLongFieldData;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -31,7 +30,7 @@ public final class DateScriptFieldData extends IndexNumericFieldData {
}
@Override
public DateScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public DateScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new DateScriptFieldData(name, leafFactory);
}
}

View File

@ -13,7 +13,6 @@ import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
import org.elasticsearch.index.fielddata.plain.LeafDoubleFieldData;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -31,7 +30,7 @@ public final class DoubleScriptFieldData extends IndexNumericFieldData {
}
@Override
public DoubleScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public DoubleScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new DoubleScriptFieldData(name, leafFactory);
}
}

View File

@ -17,7 +17,6 @@ import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.index.mapper.IpFieldMapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -36,7 +35,7 @@ public class IpScriptFieldData extends BinaryScriptFieldData {
}
@Override
public IpScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IpScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new IpScriptFieldData(name, leafFactory);
}
}

View File

@ -13,7 +13,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
import org.elasticsearch.index.fielddata.plain.LeafLongFieldData;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -33,7 +32,7 @@ public final class LongScriptFieldData extends IndexNumericFieldData {
}
@Override
public LongScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public LongScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new LongScriptFieldData(name, leafFactory);
}
}

View File

@ -11,7 +11,6 @@ import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -28,7 +27,7 @@ public class StringScriptFieldData extends BinaryScriptFieldData {
}
@Override
public StringScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public StringScriptFieldData build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new StringScriptFieldData(name, leafFactory);
}
}

View File

@ -79,7 +79,7 @@ abstract class AbstractScriptFieldTypeTestCase extends ESTestCase {
when(context.allowExpensiveQueries()).thenReturn(allowExpensiveQueries);
SearchLookup lookup = new SearchLookup(
mapperService,
(mft, lookupSupplier) -> mft.fielddataBuilder("test", lookupSupplier).build(null, null, mapperService),
(mft, lookupSupplier) -> mft.fielddataBuilder("test", lookupSupplier).build(null, null),
null
);
when(context.lookup()).thenReturn(lookup);

View File

@ -76,7 +76,7 @@ public class BooleanScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeT
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
BooleanScriptFieldType ft = simpleMappedFieldType();
BooleanScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
BooleanScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
public ScoreMode scoreMode() {
@ -113,8 +113,7 @@ public class BooleanScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeT
iw.addDocument(org.elasticsearch.common.collect.List.of(new StoredField("_source", new BytesRef("{\"foo\": [false]}"))));
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
BooleanScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup)
.build(null, null, null);
BooleanScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(reader.document(docs.scoreDocs[0].doc).getBinaryValue("_source").utf8ToString(), equalTo("{\"foo\": [false]}"));

View File

@ -115,7 +115,7 @@ public class DateScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTest
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
DateScriptFieldType ft = build("add_days", org.elasticsearch.common.collect.Map.of("days", 1));
DateScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
DateScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
public ScoreMode scoreMode() {
@ -159,7 +159,7 @@ public class DateScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTest
);
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
DateScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
DateScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(readSource(reader, docs.scoreDocs[0].doc), equalTo("{\"timestamp\": [1595432181351]}"));

View File

@ -70,7 +70,7 @@ public class DoubleScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTe
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
DoubleScriptFieldType ft = build("add_param", org.elasticsearch.common.collect.Map.of("param", 1));
DoubleScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
DoubleScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
public ScoreMode scoreMode() {
@ -108,7 +108,7 @@ public class DoubleScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTe
iw.addDocument(org.elasticsearch.common.collect.List.of(new StoredField("_source", new BytesRef("{\"foo\": [2.1]}"))));
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
DoubleScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
DoubleScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(reader.document(docs.scoreDocs[0].doc).getBinaryValue("_source").utf8ToString(), equalTo("{\"foo\": [1.1]}"));

View File

@ -78,7 +78,7 @@ public class IpScriptFieldTypeTests extends AbstractScriptFieldTypeTestCase {
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
IpScriptFieldType ft = build("append_param", org.elasticsearch.common.collect.Map.of("param", ".1"));
BinaryScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
BinaryScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
DocValueFormat format = ft.docValueFormat(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
@ -123,7 +123,7 @@ public class IpScriptFieldTypeTests extends AbstractScriptFieldTypeTestCase {
);
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
BinaryScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
BinaryScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(

View File

@ -65,7 +65,7 @@ public class KeywordScriptFieldTypeTests extends AbstractScriptFieldTypeTestCase
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
KeywordScriptFieldType ft = build("append_param", org.elasticsearch.common.collect.Map.of("param", "-suffix"));
StringScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
StringScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
public ScoreMode scoreMode() {
@ -103,7 +103,7 @@ public class KeywordScriptFieldTypeTests extends AbstractScriptFieldTypeTestCase
iw.addDocument(org.elasticsearch.common.collect.List.of(new StoredField("_source", new BytesRef("{\"foo\": [\"b\"]}"))));
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
BinaryScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
BinaryScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(reader.document(docs.scoreDocs[0].doc).getBinaryValue("_source").utf8ToString(), equalTo("{\"foo\": [\"a\"]}"));

View File

@ -70,7 +70,7 @@ public class LongScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTest
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
LongScriptFieldType ft = build("add_param", org.elasticsearch.common.collect.Map.of("param", 1));
LongScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
LongScriptFieldData ifd = ft.fielddataBuilder("test", mockContext()::lookup).build(null, null);
searcher.search(new MatchAllDocsQuery(), new Collector() {
@Override
public ScoreMode scoreMode() {
@ -108,7 +108,7 @@ public class LongScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTest
iw.addDocument(org.elasticsearch.common.collect.List.of(new StoredField("_source", new BytesRef("{\"foo\": [2]}"))));
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
LongScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null, null);
LongScriptFieldData ifd = simpleMappedFieldType().fielddataBuilder("test", mockContext()::lookup).build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(reader.document(docs.scoreDocs[0].doc).getBinaryValue("_source").utf8ToString(), equalTo("{\"foo\": [1]}"));
@ -132,7 +132,7 @@ public class LongScriptFieldTypeTests extends AbstractNonTextScriptFieldTypeTest
try (DirectoryReader reader = iw.getReader()) {
IndexSearcher searcher = newSearcher(reader);
LongScriptFieldData ifd = build("millis_ago", Collections.emptyMap()).fielddataBuilder("test", mockContext()::lookup)
.build(null, null, null);
.build(null, null);
SortField sf = ifd.sortField(null, MultiValueMode.MIN, null, false);
TopFieldDocs docs = searcher.search(new MatchAllDocsQuery(), 3, new Sort(sf));
assertThat(readSource(reader, docs.scoreDocs[0].doc), equalTo("{\"timestamp\": [1595432181356]}"));

View File

@ -15,7 +15,6 @@ import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -97,7 +96,7 @@ public abstract class AbstractLatLonShapeIndexFieldData implements IndexGeoShape
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
// ignore breaker
return new LatLonShapeIndexFieldData(name, valuesSourceType);
}

View File

@ -14,7 +14,6 @@ import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested;
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.MultiValueMode;
@ -78,9 +77,8 @@ public class VectorIndexFieldData implements IndexFieldData<VectorDVLeafFieldDat
}
@Override
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) {
public IndexFieldData<?> build(IndexFieldDataCache cache, CircuitBreakerService breakerService) {
return new VectorIndexFieldData(name, isDense, valuesSourceType);
}
}
}

View File

@ -969,8 +969,7 @@ public class WildcardFieldMapper extends FieldMapper {
@Override
public IndexFieldData<?> build(
IndexFieldDataCache cache,
CircuitBreakerService breakerService,
MapperService mapperService
CircuitBreakerService breakerService
) {
return new StringBinaryIndexFieldData(name(), CoreValuesSourceType.BYTES);
}

View File

@ -886,7 +886,7 @@ public class WildcardFieldMapperTests extends ESTestCase {
TriFunction<MappedFieldType, String, Supplier<SearchLookup>, IndexFieldData<?>> indexFieldDataLookup =
(fieldType, fieldIndexName, searchLookup) -> {
IndexFieldData.Builder builder = fieldType.fielddataBuilder(fieldIndexName, searchLookup);
return builder.build(new IndexFieldDataCache.None(), null, null);
return builder.build(new IndexFieldDataCache.None(), null);
};
return new QueryShardContext(0, idxSettings, BigArrays.NON_RECYCLING_INSTANCE, bitsetFilterCache, indexFieldDataLookup,
null, null, null, xContentRegistry(), null, null, null,