opensearch-java
opensearch-java copied to clipboard
[BUG] KNNQuery serialize precision error
What is the bug?
There is a knn query like
KnnQuery origin = new KnnQuery.Builder().field("field").vector(new float[] { 0.1f, 0.4f }).k(1).build();
When it serialize to json string, the result would be:
{"field":{"vector":[0.10000000149011612,0.4000000059604645],"k":1}}
like the test code shows:
https://github.com/opensearch-project/opensearch-java/blob/4436e89a0f48d54e47c2c33689e0b828cbb31149/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQueryTest.java#L16-L20
Do you have any additional context?
PR #882