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
Aggregator
s 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
Modifier and TypeClassDescriptionstatic class
ValuesSource for fields who's values are best thought of as byte arrays without any other meaning likekeyword
orip
.static class
ValuesSource for fields who's values are best thought of as points on a globe.static class
ValuesSource for fields who's values are best thought of as numbers.static class
ValuesSource for fields who's values are best thought of as ranges of numbers, dates, or IP addresses. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract SortedBinaryDocValues
bytesValues(org.apache.lucene.index.LeafReaderContext context)
Get a byte array like view into the values.abstract DocValueBits
docsWithValue(org.apache.lucene.index.LeafReaderContext context)
Get a "has any values" view into the values.boolean
Check if this values source supports using global and segment ordinals.boolean
Whether this values source needs scores.protected abstract Function<Rounding,Rounding.Prepared>
Build a function to prepareRounding
s.
-
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 prepareRounding
s.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
true
then it is safe to cast it toValuesSource.Bytes.WithOrdinals
.
-