Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for runtime fields #61776

Merged
merged 109 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
ecbed2c
Add runtime fields plugin under x-pack
javanna Jun 17, 2020
7ab4279
Hack together some script contexts
nik9000 Jun 17, 2020
c647278
Scripted fields: rework script contexts (#58342)
nik9000 Jun 18, 2020
7d3597b
Spotless and maybe tests?
nik9000 Jun 18, 2020
cac5f29
Merge branch 'master' into feature/runtime_fields
nik9000 Jun 26, 2020
741a30f
Fixup test case after merge
nik9000 Jun 26, 2020
5011a73
Get runtime fields tests passing
nik9000 Jun 26, 2020
59fc3d7
Merge branch 'master' into feature/runtime_fields
javanna Jul 2, 2020
e833e8e
Scripted keyword field (#58939)
javanna Jul 2, 2020
2ba8e2e
Merge branch 'master' into feature/runtime_fields
javanna Jul 6, 2020
366ca37
Merge branch 'master' into feature/runtime_fields
javanna Jul 10, 2020
949d1de
adapt to upstream changes
javanna Jul 10, 2020
fa48ccd
Merge branch 'master' into feature/runtime_fields
javanna Jul 13, 2020
2659648
Add term query for keyword script fields (#59372)
nik9000 Jul 13, 2020
f426916
Merge branch 'master' into feature/runtime_fields
javanna Jul 14, 2020
4eb18b2
Make ScriptFieldMapper a parameterized mapper (#59391)
javanna Jul 14, 2020
46fcc58
Add tests for keyword script field's fielddata (#59523)
nik9000 Jul 14, 2020
c9b9b73
Two queries for keyword script field (#59527)
nik9000 Jul 14, 2020
719ef1f
Remaining queries for script keyword fields (#59630)
nik9000 Jul 15, 2020
9dd56fd
Allow runtime fields to depend on one another (#59636)
nik9000 Jul 15, 2020
b5e9352
Merge branch 'master' into feature/runtime_fields
nik9000 Jul 15, 2020
30861e6
Runtime fields: rework script service injection (#59659)
javanna Jul 15, 2020
4ba86b1
Mark all scripted field queries as expensive (#59658)
nik9000 Jul 16, 2020
4b288e7
Merge branch 'master' into feature/runtime_fields
javanna Jul 17, 2020
d4a724c
Temporarily awaits fix failing script mapper unit tests
javanna Jul 17, 2020
9d2d91c
remove leftover printStackTrace
javanna Jul 17, 2020
bd1b2ae
Fix parsing unsupported runtime types error
javanna Jul 17, 2020
390fa65
Scripted keyword field type: update family type and test field caps o…
javanna Jul 17, 2020
45d0dc5
Pass script params through to fielddata impl (#59762)
javanna Jul 17, 2020
c8b5af9
Add long flavored script field (#59721)
nik9000 Jul 17, 2020
bdc2b16
Render script params in script field xcontent (#59813)
nik9000 Jul 20, 2020
2c5c478
Merge branch 'master' into feature/runtime_fields
javanna Jul 20, 2020
89ebf20
adapt to upstream changes
javanna Jul 20, 2020
9f5f314
Fielddata implementations to not implement IndexComponent
javanna Jul 20, 2020
0589d2e
Remaining queries for long script field (#59816)
nik9000 Jul 20, 2020
a0ef1ea
ScriptLongFieldData to extend LeafLongFieldData (#59884)
javanna Jul 21, 2020
be44fc7
Remove unused doXContentBody impl from ScriptFieldMapper (#59969)
javanna Jul 21, 2020
b81db2a
Merge branch 'master' into feature/runtime_fields
nik9000 Jul 21, 2020
26506c4
Update doc values after merge
nik9000 Jul 21, 2020
bc3267b
Make full text queries work against keyword scripted fields (#59990)
javanna Jul 21, 2020
8bddd84
Add double script fields (#59933)
nik9000 Jul 21, 2020
5fcef9a
Merge branch 'master' into feature/runtime_fields
javanna Jul 22, 2020
82392d8
Adapt to upstream changes
javanna Jul 22, 2020
9d72854
Replace script unit tests with integration tests (#60027)
nik9000 Jul 22, 2020
9adf29c
Drop some yml tests for script fields (#60079)
nik9000 Jul 22, 2020
9a3fa42
Standardize script field's rejection error (#60029)
nik9000 Jul 22, 2020
9b8bf02
Rename script field type to runtime_script (#60083)
javanna Jul 22, 2020
ad3fb94
Merge branch 'master' into feature/runtime_fields
nik9000 Jul 23, 2020
37a1418
Replace painless unit tests with mock scripts (#60094)
nik9000 Jul 23, 2020
bceb41a
Merge branch 'master' into feature/runtime_fields
javanna Jul 27, 2020
bf04ea7
adapt to upstream changes
javanna Jul 27, 2020
9026770
Pass a SearchLookup supplier through to fielddataBuilder (#60224)
javanna Jul 27, 2020
e3bbb3b
Merge branch 'master' into feature/runtime_fields
nik9000 Jul 28, 2020
cec7c13
Merge branch 'master' into feature/runtime_fields
javanna Jul 29, 2020
35ca380
Add runtime_script date field (#60092)
nik9000 Jul 29, 2020
28f6fd0
Merge branch 'master' into feature/runtime_fields
javanna Jul 31, 2020
af9b302
adapt to upstream changes
javanna Jul 31, 2020
e1cb361
Error on bad shape relations in runtime fields (#60463)
nik9000 Jul 31, 2020
0438030
Merge branch 'master' into feature/runtime_fields
javanna Aug 3, 2020
0e91859
Format support for script doc fields (#60465)
nik9000 Aug 3, 2020
b6e0609
Runtime script field mapper to reject copy_to and fields (#60580)
javanna Aug 3, 2020
ce583aa
Fix build
nik9000 Aug 3, 2020
4540211
Merge branch 'master' into feature/runtime_fields
nik9000 Aug 5, 2020
e98dfcc
Implement runtime script ips (#60533)
nik9000 Aug 5, 2020
5e3ea6e
Merge branch 'master' into feature/runtime_fields
nik9000 Aug 6, 2020
9b9aa5f
Add the ScriptService to the field parser config (#60933)
nik9000 Aug 11, 2020
fd8b557
Merge branch 'master' into feature/runtime_fields
nik9000 Aug 11, 2020
eeb4afb
Run core's integration tests with runtime fields (#60931)
nik9000 Aug 11, 2020
4a5d317
Some progress on failing runtime fields tests (#61098)
nik9000 Aug 13, 2020
f3b65eb
Implement distance_feature for runtime dates (#60851)
nik9000 Aug 17, 2020
76eb16e
Borrow more tests for runtime fields (#61113)
nik9000 Aug 17, 2020
1e63126
Include boost in `distance_feature` query equals
nik9000 Aug 17, 2020
99c885e
Merge branch 'master' into feature/runtime_fields
nik9000 Aug 17, 2020
07bfa51
Add boolean values script fields (#60830)
nik9000 Aug 17, 2020
3870b6f
Add a consistent way to parse dates (#61105)
nik9000 Aug 17, 2020
b5e8524
Fix `value` method on ip scripts (#61230)
nik9000 Aug 18, 2020
40e3aec
Opt date valued script fields out of rate limit (#61238)
nik9000 Aug 18, 2020
51a56b3
Drop compile limit on runtime fields scripts (#61297)
nik9000 Aug 19, 2020
aa3f29f
Fix wrong pipeline name in debug log (#58817)
gaobinlong Aug 17, 2020
c5d00be
[DOCS] Update CCR docs to focus on Kibana (#60555)
Aug 17, 2020
32580d8
Fix testConcurrentSnapshotDeleteAndDeleteIndex (#61228)
original-brownbear Aug 18, 2020
5026fc7
Remove Unused ByteBufferReference (#61116)
original-brownbear Aug 18, 2020
876d81e
Introduce ordering in the constant_keyword test for better predictibi…
astefan Aug 18, 2020
8bd95cd
Add UBI docker builds (#60742)
pugnascotia Aug 18, 2020
b903a8f
[DOCS] Replaces ml.node with node.roles: [ ml ] in ML settings (#61017)
szabosteve Aug 18, 2020
6a9dde5
Merge branch 'master' into feature/runtime_fields
javanna Aug 24, 2020
63d6ab2
Revert visibility change to DocLookup constructor
javanna Aug 24, 2020
e2dd0bd
Merge branch 'master' into feature/runtime_fields
nik9000 Aug 24, 2020
5858dcc
Cleanup after merge to feature/runtime_fields
nik9000 Aug 24, 2020
8818156
Drop single node test case from runtime fields (#61241)
nik9000 Aug 24, 2020
6d8170c
Convert double script to return array (#61504)
nik9000 Aug 25, 2020
0a3d391
Merge branch 'master' into feature/runtime_fields
javanna Aug 27, 2020
4a67e76
remove test that was moved and re-added while merging by mistake
javanna Aug 27, 2020
c9bd8c8
Test async and graph against runtime fields (#61651)
nik9000 Aug 27, 2020
95cdff7
Revert "Convert double script to return array (#61504)"
nik9000 Aug 31, 2020
0284f3d
Standardize runtime field emit methods (#61752)
nik9000 Aug 31, 2020
acfaccb
Adapt to upstream changes
javanna Sep 1, 2020
d47d450
Merge branch 'master' into feature/runtime_fields
javanna Sep 1, 2020
2356d7d
Support format on runtime numbers (#61787)
nik9000 Sep 1, 2020
1ea67d2
Add API test dependency
nik9000 Sep 1, 2020
34e576f
Drop security policy from runtime fields
nik9000 Sep 1, 2020
d027a71
Explicit tests for nested fields (#61761)
nik9000 Sep 1, 2020
c0802bb
Merge branch 'master' into feature/runtime_fields
nik9000 Sep 1, 2020
c916061
Merge branch 'master' into feature/runtime_fields
javanna Sep 2, 2020
0040a59
Runtime fields to expose _source and stored fields like existing scri…
javanna Sep 2, 2020
d9ca982
Test DLS and FLS against runtime fields (#61820)
javanna Sep 2, 2020
a8ae54a
Expand testing for field_caps and search across multiple indices (#61…
javanna Sep 2, 2020
8ffa4d9
Expand max chain depth testing (#61833)
javanna Sep 2, 2020
a16b080
Runtime field: test currentTimeMillis
nik9000 Sep 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ public class MetadataIndexUpgradeService {
private final MapperRegistry mapperRegistry;
private final IndexScopedSettings indexScopedSettings;
private final SystemIndices systemIndices;
private final ScriptService scriptService;

public MetadataIndexUpgradeService(Settings settings, NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry,
IndexScopedSettings indexScopedSettings, SystemIndices systemIndices) {
IndexScopedSettings indexScopedSettings, SystemIndices systemIndices, ScriptService scriptService) {
this.settings = settings;
this.xContentRegistry = xContentRegistry;
this.mapperRegistry = mapperRegistry;
this.indexScopedSettings = indexScopedSettings;
this.systemIndices = systemIndices;
this.scriptService = scriptService;
}

/**
Expand Down Expand Up @@ -185,7 +187,7 @@ public Set<Entry<String, NamedAnalyzer>> entrySet() {
try (IndexAnalyzers fakeIndexAnalzyers =
new IndexAnalyzers(analyzerMap, analyzerMap, analyzerMap)) {
MapperService mapperService = new MapperService(indexSettings, fakeIndexAnalzyers, xContentRegistry, similarityService,
mapperRegistry, () -> null, () -> false);
mapperRegistry, () -> null, () -> false, scriptService);
mapperService.merge(indexMetadata, MapperService.MergeReason.MAPPING_RECOVERY);
}
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public MapperService newIndexMapperService(NamedXContentRegistry xContentRegistr
ScriptService scriptService) throws IOException {
return new MapperService(indexSettings, analysisRegistry.build(indexSettings), xContentRegistry,
new SimilarityService(indexSettings, scriptService, similarities), mapperRegistry,
() -> { throw new UnsupportedOperationException("no index query shard context available"); }, () -> false);
() -> { throw new UnsupportedOperationException("no index query shard context available"); }, () -> false, scriptService);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@ public IndexService(
assert indexAnalyzers != null;
this.mapperService = new MapperService(indexSettings, indexAnalyzers, xContentRegistry, similarityService, mapperRegistry,
// we parse all percolator queries as they would be parsed on shard 0
() -> newQueryShardContext(0, null, System::currentTimeMillis, null), idFieldDataEnabled);
() -> newQueryShardContext(0, null, System::currentTimeMillis, null), idFieldDataEnabled, scriptService);
this.indexFieldData = new IndexFieldDataService(indexSettings, indicesFieldDataCache, circuitBreakerService, mapperService);
if (indexSettings.getIndexSortConfig().hasIndexSort()) {
// we delay the actual creation of the sort order for this index because the mapping has not been merged yet.
// The sort order is validated right after the merge of the mapping later in the process.
this.indexSortSupplier = () -> indexSettings.getIndexSortConfig().buildIndexSort(
mapperService::fieldType,
fieldType -> indexFieldData.getForField(fieldType, indexFieldData.index().getName(), () -> {
throw new UnsupportedOperationException("search lookup not available for index sorting");
})
(fieldType, searchLookup) -> indexFieldData.getForField(fieldType, indexFieldData.index().getName(), searchLookup)
);
} else {
this.indexSortSupplier = () -> null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.search.MultiValueMode;
import org.elasticsearch.search.lookup.SearchLookup;
import org.elasticsearch.search.sort.SortOrder;

import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

/**
* Holds all the information that is used to build the sort order of an index.
Expand Down Expand Up @@ -171,7 +174,7 @@ public boolean hasPrimarySortOnField(String field) {
* or returns null if this index has no sort.
*/
public Sort buildIndexSort(Function<String, MappedFieldType> fieldTypeLookup,
Function<MappedFieldType, IndexFieldData<?>> fieldDataLookup) {
BiFunction<MappedFieldType, Supplier<SearchLookup>, IndexFieldData<?>> fieldDataLookup) {
if (hasIndexSort() == false) {
return null;
}
Expand All @@ -190,7 +193,9 @@ public Sort buildIndexSort(Function<String, MappedFieldType> fieldTypeLookup,
}
IndexFieldData<?> fieldData;
try {
fieldData = fieldDataLookup.apply(ft);
fieldData = fieldDataLookup.apply(ft, () -> {
throw new UnsupportedOperationException("index sorting not supported on runtime field [" + ft.name() + "]");
});
} catch (Exception e) {
throw new IllegalArgumentException("docvalues not found for index sort field:[" + sortSpec.field + "]", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,25 +481,30 @@ protected void resize(int newSize) {
public int size() {
return count;
}

}

public static final class Strings extends BinaryScriptDocValues<String> {

public static class Strings extends BinaryScriptDocValues<String> {
public Strings(SortedBinaryDocValues in) {
super(in);
}

@Override
public String get(int index) {
public final String get(int index) {
if (count == 0) {
throw new IllegalStateException("A document doesn't have a value for a field! " +
"Use doc[<field>].size()==0 to check if a document is missing a field!");
}
return values[index].get().utf8ToString();
return bytesToString(values[index].get());
}

/**
* Convert the stored bytes to a String.
*/
protected String bytesToString(BytesRef bytes) {
return bytes.utf8ToString();
}

public String getValue() {
public final String getValue() {
return get(0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
/**
* Specialization of {@link LeafNumericFieldData} for floating-point numerics.
*/
abstract class LeafDoubleFieldData implements LeafNumericFieldData {
public abstract class LeafDoubleFieldData implements LeafNumericFieldData {

private final long ramBytesUsed;

LeafDoubleFieldData(long ramBytesUsed) {
protected LeafDoubleFieldData(long ramBytesUsed) {
this.ramBytesUsed = ramBytesUsed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
/**
* Specialization of {@link LeafNumericFieldData} for integers.
*/
abstract class LeafLongFieldData implements LeafNumericFieldData {
public abstract class LeafLongFieldData implements LeafNumericFieldData {

private final long ramBytesUsed;
/**
* Type of this field. Used to expose appropriate types in {@link #getScriptValues()}.
*/
private final NumericType numericType;

LeafLongFieldData(long ramBytesUsed, NumericType numericType) {
protected LeafLongFieldData(long ramBytesUsed, NumericType numericType) {
this.ramBytesUsed = ramBytesUsed;
this.numericType = numericType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.geo.ShapeRelation;
import org.elasticsearch.common.lucene.BytesRefs;
import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.time.DateFormatters;
import org.elasticsearch.common.time.DateMathParser;
Expand All @@ -60,6 +60,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.LongSupplier;
import java.util.function.Supplier;
Expand Down Expand Up @@ -318,60 +319,83 @@ public Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower
DateMathParser parser = forcedDateParser == null
? dateMathParser
: forcedDateParser;
return dateRangeQuery(lowerTerm, upperTerm, includeLower, includeUpper, timeZone, parser, context, resolution, (l, u) -> {
Query query = LongPoint.newRangeQuery(name(), l, u);
if (hasDocValues()) {
Query dvQuery = SortedNumericDocValuesField.newSlowRangeQuery(name(), l, u);
query = new IndexOrDocValuesQuery(query, dvQuery);

if (context.indexSortedOnField(name())) {
query = new IndexSortSortedNumericDocValuesRangeQuery(name(), l, u, query);
}
}
return query;
});
}

public static Query dateRangeQuery(
Object lowerTerm,
Object upperTerm,
boolean includeLower,
boolean includeUpper,
@Nullable ZoneId timeZone,
DateMathParser parser,
QueryShardContext context,
Resolution resolution,
BiFunction<Long, Long, Query> builder
) {
return handleNow(context, nowSupplier -> {
long l, u;
if (lowerTerm == null) {
l = Long.MIN_VALUE;
} else {
l = parseToLong(lowerTerm, !includeLower, timeZone, parser, nowSupplier, resolution);
if (includeLower == false) {
++l;
}
}
if (upperTerm == null) {
u = Long.MAX_VALUE;
} else {
u = parseToLong(upperTerm, includeUpper, timeZone, parser, nowSupplier, resolution);
if (includeUpper == false) {
--u;
}
}
return builder.apply(l, u);
});
}

/**
* Handle {@code now} in queries.
* @param context context from which to read the current time
* @param builder build the query
* @return the result of the builder, wrapped in {@link DateRangeIncludingNowQuery} if {@code now} was used.
*/
public static Query handleNow(QueryShardContext context, Function<LongSupplier, Query> builder) {
boolean[] nowUsed = new boolean[1];
LongSupplier nowSupplier = () -> {
nowUsed[0] = true;
return context.nowInMillis();
};
long l, u;
if (lowerTerm == null) {
l = Long.MIN_VALUE;
} else {
l = parseToLong(lowerTerm, !includeLower, timeZone, parser, nowSupplier);
if (includeLower == false) {
++l;
}
}
if (upperTerm == null) {
u = Long.MAX_VALUE;
} else {
u = parseToLong(upperTerm, includeUpper, timeZone, parser, nowSupplier);
if (includeUpper == false) {
--u;
}
}

Query query = LongPoint.newRangeQuery(name(), l, u);
if (hasDocValues()) {
Query dvQuery = SortedNumericDocValuesField.newSlowRangeQuery(name(), l, u);
query = new IndexOrDocValuesQuery(query, dvQuery);

if (context.indexSortedOnField(name())) {
query = new IndexSortSortedNumericDocValuesRangeQuery(name(), l, u, query);
}
}

if (nowUsed[0]) {
query = new DateRangeIncludingNowQuery(query);
}
return query;
Query query = builder.apply(nowSupplier);
return nowUsed[0] ? new DateRangeIncludingNowQuery(query) : query;
}

public long parseToLong(Object value, boolean roundUp,
@Nullable ZoneId zone, @Nullable DateMathParser forcedDateParser, LongSupplier now) {
DateMathParser dateParser = dateMathParser();
if (forcedDateParser != null) {
dateParser = forcedDateParser;
}
public long parseToLong(Object value, boolean roundUp, @Nullable ZoneId zone, DateMathParser dateParser, LongSupplier now) {
dateParser = dateParser == null ? dateMathParser() : dateParser;
return parseToLong(value, roundUp, zone, dateParser, now, resolution);
}

String strValue;
if (value instanceof BytesRef) {
strValue = ((BytesRef) value).utf8ToString();
} else {
strValue = value.toString();
}
Instant instant = dateParser.parse(strValue, now, roundUp, zone);
return resolution.convert(instant);
public static long parseToLong(
Object value,
boolean roundUp,
@Nullable ZoneId zone,
DateMathParser dateParser,
LongSupplier now,
Resolution resolution
) {
return resolution.convert(dateParser.parse(BytesRefs.toString(value), now, roundUp, zone));
}

@Override
Expand All @@ -391,7 +415,7 @@ public Relation isFieldWithinQuery(IndexReader reader,

long fromInclusive = Long.MIN_VALUE;
if (from != null) {
fromInclusive = parseToLong(from, !includeLower, timeZone, dateParser, context::nowInMillis);
fromInclusive = parseToLong(from, !includeLower, timeZone, dateParser, context::nowInMillis, resolution);
if (includeLower == false) {
if (fromInclusive == Long.MAX_VALUE) {
return Relation.DISJOINT;
Expand All @@ -402,7 +426,7 @@ public Relation isFieldWithinQuery(IndexReader reader,

long toInclusive = Long.MAX_VALUE;
if (to != null) {
toInclusive = parseToLong(to, includeUpper, timeZone, dateParser, context::nowInMillis);
toInclusive = parseToLong(to, includeUpper, timeZone, dateParser, context::nowInMillis, resolution);
if (includeUpper == false) {
if (toInclusive == Long.MIN_VALUE) {
return Relation.DISJOINT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.indices.mapper.MapperRegistry;
import org.elasticsearch.script.ScriptService;

import java.util.Collections;
import java.util.HashMap;
Expand All @@ -53,26 +54,29 @@ public class DocumentMapperParser {

private final Map<String, Mapper.TypeParser> typeParsers;
private final Map<String, MetadataFieldMapper.TypeParser> rootTypeParsers;
private final ScriptService scriptService;

public DocumentMapperParser(IndexSettings indexSettings, MapperService mapperService, NamedXContentRegistry xContentRegistry,
SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<QueryShardContext> queryShardContextSupplier) {
SimilarityService similarityService, MapperRegistry mapperRegistry,
Supplier<QueryShardContext> queryShardContextSupplier, ScriptService scriptService) {
this.mapperService = mapperService;
this.xContentRegistry = xContentRegistry;
this.similarityService = similarityService;
this.queryShardContextSupplier = queryShardContextSupplier;
this.scriptService = scriptService;
this.typeParsers = mapperRegistry.getMapperParsers();
this.indexVersionCreated = indexSettings.getIndexVersionCreated();
this.rootTypeParsers = mapperRegistry.getMetadataMapperParsers(indexVersionCreated);
}

public Mapper.TypeParser.ParserContext parserContext() {
return new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperService,
typeParsers::get, indexVersionCreated, queryShardContextSupplier, null);
typeParsers::get, indexVersionCreated, queryShardContextSupplier, null, scriptService);
}

public Mapper.TypeParser.ParserContext parserContext(DateFormatter dateFormatter) {
return new Mapper.TypeParser.ParserContext(similarityService::getSimilarity, mapperService,
typeParsers::get, indexVersionCreated, queryShardContextSupplier, dateFormatter);
typeParsers::get, indexVersionCreated, queryShardContextSupplier, dateFormatter, scriptService);
}

public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException {
Expand Down
Loading