Inconsistency between deserialization of number values in _msearch/_mget and _search/_get - elasticsearch-java client (7.16.2)

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 deserializing to this class:

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.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.