Module org.elasticsearch.server
Package org.elasticsearch.index.mapper
Class ArraySourceValueFetcher
java.lang.Object
org.elasticsearch.index.mapper.ArraySourceValueFetcher
- All Implemented Interfaces:
ValueFetcher
An implementation of
ValueFetcher
that knows how to extract values
from the document source.
This class differs from SourceValueFetcher
in that it directly handles
array values in parsing. Field types should use this class if their corresponding
mapper returns true for FieldMapper.parsesArrayValue()
.-
Field Summary
Fields inherited from interface org.elasticsearch.index.mapper.ValueFetcher
EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionArraySourceValueFetcher
(String fieldName, SearchExecutionContext context) ArraySourceValueFetcher
(String fieldName, SearchExecutionContext context, Object nullValue) ArraySourceValueFetcher
(Set<String> sourcePaths, Object nullValue) -
Method Summary
Modifier and TypeMethodDescriptionfetchValues
(Source source, int doc, List<Object> ignoredValues) This method is consumed byValueFetcher.fetchDocumentField(String, Source, int)
.protected abstract Object
parseSourceValue
(Object value) Given a value that has been extracted from a document's source, parse it into a standard format.The stored field or source requirements of this value fetcherMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.index.mapper.ValueFetcher
fetchDocumentField, setNextReader
-
Constructor Details
-
ArraySourceValueFetcher
-
ArraySourceValueFetcher
- Parameters:
fieldName
- The name of the field.context
- The query shard contextnullValue
- A optional substitute value if the _source value is 'null'.
-
ArraySourceValueFetcher
- Parameters:
sourcePaths
- The paths to pull source values fromnullValue
- An optional substitute value if the _source value is `null`
-
-
Method Details
-
fetchValues
Description copied from interface:ValueFetcher
This method is consumed byValueFetcher.fetchDocumentField(String, Source, int)
. Given access to a document's _source, return this field's values.In addition to pulling out the values, they will be parsed into a standard form. For example numeric field mappers make sure to parse the source value into a number of the right type.
Note that for array values, the order in which values are returned is undefined and should not be relied on.
- Specified by:
fetchValues
in interfaceValueFetcher
- Parameters:
source
- the document's source.doc
- the document idignoredValues
- a mutable list to collect any ignored values as they were originally presented in source- Returns:
- a list a standardized field values.
-
storedFieldsSpec
Description copied from interface:ValueFetcher
The stored field or source requirements of this value fetcher- Specified by:
storedFieldsSpec
in interfaceValueFetcher
-
parseSourceValue
Given a value that has been extracted from a document's source, parse it into a standard format. This parsing logic should closely mirror the value parsing inFieldMapper.parseCreateField(org.elasticsearch.index.mapper.DocumentParserContext)
orFieldMapper.parse(org.elasticsearch.index.mapper.DocumentParserContext)
.
-