java.lang.Object
org.elasticsearch.search.lookup.SearchLookup
- All Implemented Interfaces:
SourceProvider
Provides a way to look up per-document values from docvalues, stored fields or _source
-
Constructor Summary
ConstructorsConstructorDescriptionSearchLookup(Function<String, MappedFieldType> fieldTypeLookup, TriFunction<MappedFieldType, Supplier<SearchLookup>, MappedFieldType.FielddataOperation, IndexFieldData<?>> fieldDataLookup, SourceProvider sourceProvider) Create a new SearchLookup, using the default stored fields providerSearchLookup(Function<String, MappedFieldType> fieldTypeLookup, TriFunction<MappedFieldType, Supplier<SearchLookup>, MappedFieldType.FielddataOperation, IndexFieldData<?>> fieldDataLookup, SourceProvider sourceProvider, Function<org.apache.lucene.index.LeafReaderContext, LeafFieldLookupProvider> fieldLookupProvider) Create a new SearchLookup, using the default stored fields provider -
Method Summary
Modifier and TypeMethodDescriptionfinal SearchLookupCreates a copy of the currentSearchLookupthat looks fields up in the same way, but also tracks field references in order to detect cycles and prevent resolving fields that depend on more thanMAX_FIELD_CHAIN_DEPTHother fields.getForField(MappedFieldType fieldType, MappedFieldType.FielddataOperation options) getLeafSearchLookup(org.apache.lucene.index.LeafReaderContext context) getSource(org.apache.lucene.index.LeafReaderContext ctx, int doc) Get the Source for the given doc within the given context
-
Constructor Details
-
SearchLookup
public SearchLookup(Function<String, MappedFieldType> fieldTypeLookup, TriFunction<MappedFieldType, Supplier<SearchLookup>, MappedFieldType.FielddataOperation, IndexFieldData<?>> fieldDataLookup, SourceProvider sourceProvider) Create a new SearchLookup, using the default stored fields provider- Parameters:
fieldTypeLookup- defines how to look up field typesfieldDataLookup- defines how to look up field datasourceProvider- defines how to look up the source
-
SearchLookup
public SearchLookup(Function<String, MappedFieldType> fieldTypeLookup, TriFunction<MappedFieldType, Supplier<SearchLookup>, MappedFieldType.FielddataOperation, IndexFieldData<?>> fieldDataLookup, SourceProvider sourceProvider, Function<org.apache.lucene.index.LeafReaderContext, LeafFieldLookupProvider> fieldLookupProvider) Create a new SearchLookup, using the default stored fields provider- Parameters:
fieldTypeLookup- defines how to look up field typesfieldDataLookup- defines how to look up field datasourceProvider- defines how to look up the sourcefieldLookupProvider- defines how to look up stored fields
-
-
Method Details
-
forkAndTrackFieldReferences
Creates a copy of the currentSearchLookupthat looks fields up in the same way, but also tracks field references in order to detect cycles and prevent resolving fields that depend on more thanMAX_FIELD_CHAIN_DEPTHother fields.- Parameters:
field- the field being referred to, for which fielddata needs to be loaded- Returns:
- the new lookup
- Throws:
IllegalArgumentException- if a cycle is detected in the fields required to build doc values, or if the field being resolved depends on more thanMAX_FIELD_CHAIN_DEPTH
-
getLeafSearchLookup
-
fieldType
-
getForField
public IndexFieldData<?> getForField(MappedFieldType fieldType, MappedFieldType.FielddataOperation options) -
getSource
Description copied from interface:SourceProviderGet the Source for the given doc within the given context- Specified by:
getSourcein interfaceSourceProvider- Throws:
IOException
-