Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jakub-Mikolajczyk-pl opened this issue Feb 10, 2022 · 1 comment · Fixed by #289

Comments

@Jakub-Mikolajczyk-pl
Copy link

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.

@swallez
Copy link
Member

swallez commented May 23, 2022

This has been fixed in #289 and backported to 8.2 and 7.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants