Skip to content

Inconsistency between deserialization of _msearch/_mget and _search/_get number values #156

Closed
@Jakub-Mikolajczyk-pl

Description

@Jakub-Mikolajczyk-pl

Hi, I have a problem with scientific notation numbers returned from elastic through _search/_get and _msearch/_mget.

Value in elastic _source is = 1.4778125E7.

Queried through dev console is always returned the same = 1.4778125E7. For _search/_get and _msearch/_mget.

But through client _msearch/_mget calls, results return the value as Integer 14778125.

I can't provide exact code, but the problem with deserialized code happens with:

public class Trade {
	@JsonProperty("Definition")
	@NotNull
	private TradeDefinition definition = new TradeDefinition(); //Where this value is stored
}

public class TradeDefinition extends HashMap<String, Object> {}

Call to api is done with basic pointing to id and providing Trade.class as tDocumentClass.

After some debugging, I can say that there are used different deserialization implementations:

  • for _search/_get calls co.elastic.clients.json.ObjectDeserializer works correctly, returning the value with scientific notation and as Double.
  • for _msearch/_mget I can tell that this number is deserialized by co.elastic.clients.json.UnionDeserializer and in one moment the value pops up as JsonBigDecimalNumber, losing the notation.

I'm using the default JacksonJsonpMapper from the package. I tried to disable DeserializationFeature.ACCEPT_FLOAT_AS_INT but nothing changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions