Class ValuesSource
java.lang.Object
org.elasticsearch.search.aggregations.support.ValuesSource
- Direct Known Subclasses:
ValuesSource.Bytes,ValuesSource.GeoPoint,ValuesSource.Numeric,ValuesSource.Range
public abstract class ValuesSource
extends java.lang.Object
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 CellIdSource 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 Classes Modifier and Type Class Description static classValuesSource.BytesValuesSource for fields who's values are best thought of as byte arrays without any other meaning likekeywordorip.static classValuesSource.GeoPointValuesSource for fields who's values are best thought of as points on a globe.static classValuesSource.NumericValuesSource for fields who's values are best thought of as numbers.static classValuesSource.RangeValuesSource for fields who's values are best thought of as ranges of numbers, dates, or IP addresses. -
Constructor Summary
Constructors Constructor Description ValuesSource() -
Method Summary
Modifier and Type Method Description abstract 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.booleanhasOrdinals()Check if this values source supports using global and segment ordinals.booleanneedsScores()Whether this values source needs scores.protected abstract java.util.function.Function<Rounding,Rounding.Prepared>roundingPreparer()Build a function to prepareRoundings.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ValuesSource
public ValuesSource()
-
-
Method Details
-
bytesValues
public abstract SortedBinaryDocValues bytesValues(org.apache.lucene.index.LeafReaderContext context) throws java.io.IOExceptionGet a byte array like view into the values. This is the "native" way to accessValuesSource.Bytes-style values.- Throws:
java.io.IOException
-
docsWithValue
public abstract DocValueBits docsWithValue(org.apache.lucene.index.LeafReaderContext context) throws java.io.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:
java.io.IOException
-
needsScores
public boolean needsScores()Whether this values source needs scores. -
roundingPreparer
protected abstract java.util.function.Function<Rounding,Rounding.Prepared> roundingPreparer() throws java.io.IOExceptionBuild 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:
java.io.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.
-