Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Invalid type conversion Integer -> Double #674

Open
strkkk opened this issue Mar 27, 2020 · 0 comments
Open

Invalid type conversion Integer -> Double #674

strkkk opened this issue Mar 27, 2020 · 0 comments

Comments

@strkkk
Copy link

strkkk commented Mar 27, 2020

Jest version 6.3.1
ES version 6.4.2

Description:
After search result is back, if getHits() method changes type of result from Integer to Double

private JestClient client;
Class<Map<String, Object>> clazz = (Class<Map<String, Object>>) (Class) Map.class;
SearchResult result = client.execute(search);
System.out.println(result);
List<Map<String, Object>> foundSources =
        result.getHits(clazz).stream().map(hit -> hit.source).collect(Collectors.toList());
System.out.println(foundSources);

Output

Result: {"took":33,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"my_index","_type":"row","_id":"QgmKHHEBsa_VKQHeUjtF","_score":null,
"_source":{"mass":2041.9969,"length":20,"score":80,"mz":681.6733,},"sort":[80]}]}}, isSucceeded: true, response code: 200, error message: null
-------------------------------------^----------^-- integers


[{mass=2041.9969, length=20.0, score=80.0, mz=681.6733, es_metadata_id=QgmKHHEBsa_VKQHeUjtF}]
--------------------------^----------^-- doubles

fields "length" and "score" are integer in SearchResult, but converted to double if getHits is invoked.

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

No branches or pull requests

1 participant