Class ValuesSource
java.lang.Object
org.elasticsearch.search.aggregations.support.ValuesSource
- Direct Known Subclasses:
ValuesSource.Bytes,ValuesSource.GeoPoint,ValuesSource.Numeric,ValuesSource.Range
A unified interface to different ways of getting input data for
Aggregators like DocValues from Lucene or script output. The
top level sub-classes define type-specific behavior, such as
ValuesSource.Numeric.isFloatingPoint(). Second level subclasses are
then specialized based on where they read values from, e.g. script or field
cases. There are also adapter classes like GeoTileCellIdSource which do
run-time conversion from one type to another, often dependent on a user
specified parameter (precision in that case).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classValuesSource for fields who's values are best thought of as byte arrays without any other meaning likekeywordorip.static classValuesSource for fields who's values are best thought of as points on a globe.static classValuesSource for fields who's values are best thought of as numbers.static classValuesSource for fields who's values are best thought of as ranges of numbers, dates, or IP addresses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract SortedBinaryDocValuesbytesValues(org.apache.lucene.index.LeafReaderContext context)Get a byte array like view into the values.abstract DocValueBitsdocsWithValue(org.apache.lucene.index.LeafReaderContext context)Get a "has any values" view into the values.booleanCheck if this values source supports using global and segment ordinals.booleanWhether this values source needs scores.protected abstract Function<Rounding,Rounding.Prepared>Build a function to prepareRoundings.
-
Constructor Details
-
ValuesSource
public ValuesSource()
-
-
Method Details
-
bytesValues
public abstract SortedBinaryDocValues bytesValues(org.apache.lucene.index.LeafReaderContext context) throws IOExceptionGet a byte array like view into the values. This is the "native" way to accessValuesSource.Bytes-style values.- Throws:
IOException
-
docsWithValue
public abstract DocValueBits docsWithValue(org.apache.lucene.index.LeafReaderContext context) throws IOExceptionGet a "has any values" view into the values. It'll try to pick the "most native" way to check if there are any values, but it builds its own view into the values so if you need any of the actual values its best to use something likebytesValues(org.apache.lucene.index.LeafReaderContext)orValuesSource.Numeric.doubleValues(org.apache.lucene.index.LeafReaderContext)but if you just need to know if there are any values then use this.- Throws:
IOException
-
needsScores
public boolean needsScores()Whether this values source needs scores. -
roundingPreparer
Build a function to prepareRoundings.This returns a Function because auto date histogram will need to call it many times over the course of running the aggregation. Other aggregations should feel free to call it once.
- Throws:
IOException
-
hasOrdinals
public boolean hasOrdinals()Check if this values source supports using global and segment ordinals.If this returns
truethen it is safe to cast it toValuesSource.Bytes.WithOrdinals.
-