Interface ElasticsearchFieldCodec<F>
- All Known Subinterfaces:
ElasticsearchVectorFieldCodec<F>
- All Known Implementing Classes:
AbstractElasticsearchFieldCodec,AbstractElasticsearchJavaTimeFieldCodec,AbstractElasticsearchVectorFieldCodec,ElasticsearchBigDecimalFieldCodec,ElasticsearchBigIntegerFieldCodec,ElasticsearchBooleanFieldCodec,ElasticsearchByteFieldCodec,ElasticsearchByteVectorFieldCodec,ElasticsearchDoubleFieldCodec,ElasticsearchFloatFieldCodec,ElasticsearchFloatVectorFieldCodec,ElasticsearchGeoPointFieldCodec,ElasticsearchInstantFieldCodec,ElasticsearchIntegerFieldCodec,ElasticsearchJsonElementFieldCodec,ElasticsearchLocalDateFieldCodec,ElasticsearchLocalDateTimeFieldCodec,ElasticsearchLocalTimeFieldCodec,ElasticsearchLongFieldCodec,ElasticsearchMonthDayFieldCodec,ElasticsearchOffsetDateTimeFieldCodec,ElasticsearchOffsetTimeFieldCodec,ElasticsearchShortFieldCodec,ElasticsearchStringFieldCodec,ElasticsearchYearFieldCodec,ElasticsearchYearMonthFieldCodec,ElasticsearchZonedDateTimeFieldCodec
public interface ElasticsearchFieldCodec<F>
Defines how a given value will be encoded as JSON and decoded from JSON.
Encodes values received from an IndexFieldReference when indexing,
and returns decoded values to the ElasticsearchSearchProjection
when projecting in a search query.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanWhether this codec can extract data from JsonArrays when decoding.decode(com.google.gson.JsonElement element) default FdecodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString) Decodes the key returned by a term aggregation.com.google.gson.JsonElementdefault com.google.gson.JsonElementencodeForAggregation(ElasticsearchSearchSyntax searchSyntax, F value) Encodes a value for inclusion in an aggregation request.default com.google.gson.JsonElementencodeForMissing(F value) fromJsonElementToString(com.google.gson.JsonElement value) com.google.gson.JsonElementfromJsonStringToElement(String value) booleanisCompatibleWith(ElasticsearchFieldCodec<?> other) Determine whether another codec is compatible with this one, i.e. whether it will encode/decode the information to/from the document in a compatible way.
-
Method Details
-
encode
-
encodeForMissing
-
encodeForAggregation
default com.google.gson.JsonElement encodeForAggregation(ElasticsearchSearchSyntax searchSyntax, F value) Encodes a value for inclusion in an aggregation request.- Parameters:
searchSyntax- The search syntax.value- The value to encode.- Returns:
- The encoded value.
-
decode
-
decodeAggregationKey
default F decodeAggregationKey(com.google.gson.JsonElement key, com.google.gson.JsonElement keyAsString) Decodes the key returned by a term aggregation.- Parameters:
key- The "key" property returned by the aggregation. May be a number, a string, ... depending on the field type.keyAsString- The "key_as_string" property returned by the term aggregation. Either null or aJsonPrimitivecontaining a string.- Returns:
- The decoded term.
-
isCompatibleWith
Determine whether another codec is compatible with this one, i.e. whether it will encode/decode the information to/from the document in a compatible way.- Parameters:
other- AnotherElasticsearchFieldCodec, nevernull.- Returns:
trueif the given codec is compatible.falseotherwise, or when in doubt.
-
canDecodeArrays
default boolean canDecodeArrays()Whether this codec can extract data from JsonArrays when decoding. -
fromJsonStringToElement
-
fromJsonElementToString
-