Interface ElasticsearchFieldCodec<F>

    • Method Detail

      • encode

        com.google.gson.JsonElement encode​(F value)
      • encodeForMissing

        default com.google.gson.JsonElement encodeForMissing​(F value)
      • 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

        F decode​(com.google.gson.JsonElement element)
      • 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 a JsonPrimitive containing a string.
        Returns:
        The decoded term.
      • isCompatibleWith

        boolean isCompatibleWith​(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.
        Parameters:
        other - Another ElasticsearchFieldCodec, never null.
        Returns:
        true if the given codec is compatible. false otherwise, or when in doubt.