Moved the decision to load p/c fielddata eagerly to a better place.
Closes #5569
This commit is contained in:
parent
c3089701f2
commit
f389c666c1
|
@ -33,6 +33,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.lucene.BytesRefs;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.common.lucene.search.Queries;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||
|
@ -74,6 +75,10 @@ public class ParentFieldMapper extends AbstractFieldMapper<Uid> implements Inter
|
|||
|
||||
public static class Builder extends Mapper.Builder<Builder, ParentFieldMapper> {
|
||||
|
||||
private static final Settings FIELD_DATA_SETTINGS = ImmutableSettings.settingsBuilder()
|
||||
.put(Loading.KEY, Loading.EAGER_VALUE)
|
||||
.build();
|
||||
|
||||
protected String indexName;
|
||||
|
||||
private String type;
|
||||
|
@ -100,7 +105,7 @@ public class ParentFieldMapper extends AbstractFieldMapper<Uid> implements Inter
|
|||
if (type == null) {
|
||||
throw new MapperParsingException("Parent mapping must contain the parent type");
|
||||
}
|
||||
return new ParentFieldMapper(name, indexName, type, postingsFormat, null, context.indexSettings());
|
||||
return new ParentFieldMapper(name, indexName, type, postingsFormat, FIELD_DATA_SETTINGS, context.indexSettings());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,9 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.common.util.BigArrays;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentMapLong;
|
||||
import org.elasticsearch.common.xcontent.*;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.engine.Engine;
|
||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||
|
@ -52,7 +54,6 @@ import org.elasticsearch.index.mapper.DocumentMapper;
|
|||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.FieldMapper.Loading;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.mapper.internal.ParentFieldMapper;
|
||||
import org.elasticsearch.index.query.TemplateQueryParser;
|
||||
import org.elasticsearch.index.search.stats.StatsGroupsParseElement;
|
||||
import org.elasticsearch.index.service.IndexService;
|
||||
|
@ -767,16 +768,9 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
|||
if (fieldDataType == null) {
|
||||
continue;
|
||||
}
|
||||
if (fieldMapper instanceof ParentFieldMapper) {
|
||||
ParentFieldMapper parentFieldMapper = (ParentFieldMapper) fieldMapper;
|
||||
if (!parentFieldMapper.active()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (fieldDataType.getLoading() != Loading.EAGER) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
final String indexName = fieldMapper.names().indexName();
|
||||
if (warmUp.containsKey(indexName)) {
|
||||
|
|
Loading…
Reference in New Issue