@Override public final SortedNumericDocValues getLongValues() { return FieldData.castToLong(getDoubleValues()); }
/** * Return a {@link SortedNumericDoubleValues} that doesn't contain any value. */ public static MultiGeoPointValues emptyMultiGeoPoints() { return singleton(emptyGeoPoint()); }
/** * Return a {@link String} representation of the provided values. That is * typically used for scripts or for the `map` execution mode of terms aggs. * NOTE: this is very slow! */ public static SortedBinaryDocValues toString(final SortedNumericDoubleValues values) { return toString(new ToStringValues() { @Override public boolean advanceExact(int doc) throws IOException { return values.advanceExact(doc); } @Override public void get(List<CharSequence> list) throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { list.add(Double.toString(values.nextValue())); } } }); }
/** * Return a {@link SortedNumericDoubleValues} that doesn't contain any value. */ public static SortedNumericDoubleValues emptySortedNumericDoubles() { return singleton(emptyNumericDouble()); }
return FieldData.replaceMissing(FieldData.emptyNumericDouble(), missingValue);
@Override public SortedBinaryDocValues getBytesValues() { try { final BinaryDocValues values = DocValues.getBinary(reader, field); return FieldData.singleton(values); } catch (IOException e) { throw new IllegalStateException("Cannot load doc values", e); } }
@Override public Bits docsWithValue(LeafReaderContext context) { final MultiGeoPointValues geoPoints = geoPointValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(geoPoints) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(geoPoints); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(geoPoints, context.reader().maxDoc()); } }
@Override public SortedNumericDoubleValues getDoubleValues() { return FieldData.emptySortedNumericDoubles(); }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException { return org.elasticsearch.index.fielddata.FieldData.emptySortedBinary(); }
final MultiGeoPointValues geoPointValues, final GeoPoint... fromPoints) { final GeoPointValues singleValues = FieldData.unwrapSingleton(geoPointValues); if (singleValues != null && fromPoints.length == 1) { return FieldData.singleton(new NumericDoubleValues() {
@Override public DocValueBits docsWithValue(LeafReaderContext context) throws IOException { final SortedSetDocValues ordinals = ordinalsValues(context); return org.elasticsearch.index.fielddata.FieldData.docsWithValue(ordinals); }
@Override public MultiGeoPointValues getGeoPointValues() { return FieldData.emptyMultiGeoPoints(); } };
@Override public final SortedNumericDoubleValues getDoubleValues() { return FieldData.castToDouble(getLongValues()); }
return FieldData.replaceMissing(FieldData.emptyNumericDouble(), missingValue); return select(FieldData.emptySortedBinary(), missingValue);
/** * Return a {@link SortedNumericDoubleValues} that doesn't contain any value. */ public static SortedNumericDoubleValues emptySortedNumericDoubles() { return singleton(emptyNumericDouble()); }
/** * Return a {@link SortedBinaryDocValues} that doesn't contain any value. */ public static SortedBinaryDocValues emptySortedBinary() { return singleton(DocValues.emptyBinary()); }
@Override public Bits docsWithValue(LeafReaderContext context) throws IOException { final SortedBinaryDocValues bytes = bytesValues(context); if (org.elasticsearch.index.fielddata.FieldData.unwrapSingleton(bytes) != null) { return org.elasticsearch.index.fielddata.FieldData.unwrapSingletonBits(bytes); } else { return org.elasticsearch.index.fielddata.FieldData.docsWithValue(bytes, context.reader().maxDoc()); } }
@Override public SortedNumericDoubleValues doubleValues(LeafReaderContext context) throws IOException { return org.elasticsearch.index.fielddata.FieldData.emptySortedNumericDoubles(); }
@Override public SortedBinaryDocValues bytesValues(LeafReaderContext context) throws IOException { return org.elasticsearch.index.fielddata.FieldData.emptySortedBinary(); }
@Override public DocValueBits docsWithValue(LeafReaderContext context) throws IOException { final MultiGeoPointValues geoPoints = geoPointValues(context); return org.elasticsearch.index.fielddata.FieldData.docsWithValue(geoPoints); }