|
|
@@ -23,6 +23,7 @@ import org.elasticsearch.Version;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.time.DateFormatter;
|
|
|
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
|
|
+import org.elasticsearch.index.IndexSettings;
|
|
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
|
|
import org.elasticsearch.index.query.QueryShardContext;
|
|
|
import org.elasticsearch.index.similarity.SimilarityProvider;
|
|
|
@@ -30,6 +31,7 @@ import org.elasticsearch.script.ScriptService;
|
|
|
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.function.BooleanSupplier;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
@@ -79,48 +81,55 @@ public abstract class Mapper implements ToXContentFragment, Iterable<Mapper> {
|
|
|
class ParserContext {
|
|
|
|
|
|
private final Function<String, SimilarityProvider> similarityLookupService;
|
|
|
-
|
|
|
- private final MapperService mapperService;
|
|
|
-
|
|
|
private final Function<String, TypeParser> typeParsers;
|
|
|
-
|
|
|
private final Version indexVersionCreated;
|
|
|
-
|
|
|
private final Supplier<QueryShardContext> queryShardContextSupplier;
|
|
|
-
|
|
|
private final DateFormatter dateFormatter;
|
|
|
-
|
|
|
private final ScriptService scriptService;
|
|
|
+ private final IndexAnalyzers indexAnalyzers;
|
|
|
+ private final IndexSettings indexSettings;
|
|
|
+ private final BooleanSupplier idFieldDataEnabled;
|
|
|
|
|
|
public ParserContext(Function<String, SimilarityProvider> similarityLookupService,
|
|
|
- MapperService mapperService, Function<String, TypeParser> typeParsers,
|
|
|
- Version indexVersionCreated, Supplier<QueryShardContext> queryShardContextSupplier,
|
|
|
- DateFormatter dateFormatter, ScriptService scriptService) {
|
|
|
+ Function<String, TypeParser> typeParsers,
|
|
|
+ Version indexVersionCreated,
|
|
|
+ Supplier<QueryShardContext> queryShardContextSupplier,
|
|
|
+ DateFormatter dateFormatter,
|
|
|
+ ScriptService scriptService,
|
|
|
+ IndexAnalyzers indexAnalyzers,
|
|
|
+ IndexSettings indexSettings,
|
|
|
+ BooleanSupplier idFieldDataEnabled) {
|
|
|
this.similarityLookupService = similarityLookupService;
|
|
|
- this.mapperService = mapperService;
|
|
|
this.typeParsers = typeParsers;
|
|
|
this.indexVersionCreated = indexVersionCreated;
|
|
|
this.queryShardContextSupplier = queryShardContextSupplier;
|
|
|
this.dateFormatter = dateFormatter;
|
|
|
this.scriptService = scriptService;
|
|
|
+ this.indexAnalyzers = indexAnalyzers;
|
|
|
+ this.indexSettings = indexSettings;
|
|
|
+ this.idFieldDataEnabled = idFieldDataEnabled;
|
|
|
}
|
|
|
|
|
|
public IndexAnalyzers getIndexAnalyzers() {
|
|
|
- return mapperService.getIndexAnalyzers();
|
|
|
+ return indexAnalyzers;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IndexSettings getIndexSettings() {
|
|
|
+ return indexSettings;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isIdFieldDataEnabled() {
|
|
|
+ return idFieldDataEnabled.getAsBoolean();
|
|
|
}
|
|
|
|
|
|
public Settings getSettings() {
|
|
|
- return mapperService.getIndexSettings().getSettings();
|
|
|
+ return indexSettings.getSettings();
|
|
|
}
|
|
|
|
|
|
public SimilarityProvider getSimilarity(String name) {
|
|
|
return similarityLookupService.apply(name);
|
|
|
}
|
|
|
|
|
|
- public MapperService mapperService() {
|
|
|
- return mapperService;
|
|
|
- }
|
|
|
-
|
|
|
public TypeParser typeParser(String type) {
|
|
|
return typeParsers.apply(type);
|
|
|
}
|
|
|
@@ -161,14 +170,13 @@ public abstract class Mapper implements ToXContentFragment, Iterable<Mapper> {
|
|
|
|
|
|
static class MultiFieldParserContext extends ParserContext {
|
|
|
MultiFieldParserContext(ParserContext in) {
|
|
|
- super(in.similarityLookupService(), in.mapperService(), in.typeParsers(),
|
|
|
- in.indexVersionCreated(), in.queryShardContextSupplier(), in.getDateFormatter(), in.scriptService());
|
|
|
+ super(in.similarityLookupService, in.typeParsers, in.indexVersionCreated, in.queryShardContextSupplier,
|
|
|
+ in.dateFormatter, in.scriptService, in.indexAnalyzers, in.indexSettings, in.idFieldDataEnabled);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean isWithinMultiField() { return true; }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException;
|