Module org.elasticsearch.server
Package org.elasticsearch.index.mapper
Enum Class NumberFieldMapper.NumberType
java.lang.Object
java.lang.Enum<NumberFieldMapper.NumberType>
org.elasticsearch.index.mapper.NumberFieldMapper.NumberType
- All Implemented Interfaces:
Serializable
,Comparable<NumberFieldMapper.NumberType>
,Constable
- Enclosing class:
- NumberFieldMapper
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
addFields
(LuceneDocument document, String name, Number value, boolean indexed, boolean docValued, boolean stored) Maps the givenvalue
to one or more Lucene field values ands them to the givendocument
under the givenname
.compile
(String fieldName, Script script, ScriptCompiler compiler) static org.apache.lucene.search.Query
doubleRangeQuery
(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, BiFunction<Double, Double, org.apache.lucene.search.Query> builder) abstract IndexFieldData.Builder
getFieldDataBuilder
(String name) getValueFetcherFieldDataBuilder
(String name, SourceLookup sourceLookup, ValueFetcher valueFetcher) static boolean
hasDecimalPart
(Object number) Returns true if the object is a number and has a decimal partstatic org.apache.lucene.search.Query
longRangeQuery
(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, BiFunction<Long, Long, org.apache.lucene.search.Query> builder) Processes query bounds intolong
s and delegates the providedbuilder
to build a range query.Get the associated numeric typestatic double
objectToDouble
(Object value) Converts an Object to a double by checking it against known types firststatic long
objectToLong
(Object value, boolean coerce) Converts an Object to along
by checking it against known types and checking its range.abstract Number
abstract Number
parse
(XContentParser parser, boolean coerce) abstract Number
parsePoint
(byte[] value) final FieldMapper.TypeParser
parser()
abstract org.apache.lucene.search.Query
rangeQuery
(String field, Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, boolean hasDocValues, SearchExecutionContext context, boolean isIndexed) double
reduceToStoredPrecision
(double value) Adjusts a value to the value it would have been had it been parsed by that mapper and then cast up to a double.abstract org.apache.lucene.search.Query
abstract org.apache.lucene.search.Query
termsQuery
(String field, Collection<?> values) final String
typeName()
Get the associated type name.static NumberFieldMapper.NumberType
Returns the enum constant of this class with the specified name.static NumberFieldMapper.NumberType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HALF_FLOAT
-
FLOAT
-
DOUBLE
-
BYTE
-
SHORT
-
INTEGER
-
LONG
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
typeName
Get the associated type name. -
numericType
Get the associated numeric type -
parser
-
termQuery
-
termsQuery
-
rangeQuery
public abstract org.apache.lucene.search.Query rangeQuery(String field, Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, boolean hasDocValues, SearchExecutionContext context, boolean isIndexed) -
parse
- Throws:
IOException
-
parse
-
parsePoint
-
addFields
public abstract void addFields(LuceneDocument document, String name, Number value, boolean indexed, boolean docValued, boolean stored) Maps the givenvalue
to one or more Lucene field values ands them to the givendocument
under the givenname
.- Parameters:
document
- document to add fields toname
- field namevalue
- value to mapindexed
- whether or not the field is indexeddocValued
- whether or not doc values should be addedstored
- whether or not the field is stored
-
compile
-
hasDecimalPart
Returns true if the object is a number and has a decimal part -
objectToDouble
Converts an Object to a double by checking it against known types first -
objectToLong
Converts an Object to along
by checking it against known types and checking its range. -
doubleRangeQuery
public static org.apache.lucene.search.Query doubleRangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, BiFunction<Double, Double, org.apache.lucene.search.Query> builder) -
longRangeQuery
public static org.apache.lucene.search.Query longRangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, BiFunction<Long, Long, org.apache.lucene.search.Query> builder) Processes query bounds intolong
s and delegates the providedbuilder
to build a range query. -
getFieldDataBuilder
-
getValueFetcherFieldDataBuilder
public IndexFieldData.Builder getValueFetcherFieldDataBuilder(String name, SourceLookup sourceLookup, ValueFetcher valueFetcher) -
reduceToStoredPrecision
public double reduceToStoredPrecision(double value) Adjusts a value to the value it would have been had it been parsed by that mapper and then cast up to a double. This is meant to be an entry point to manipulate values before the actual value is parsed.- Parameters:
value
- the value to reduce to the field stored value- Returns:
- the double value
-