Ajinkya Pisal
Ajinkya Pisal

Reputation: 591

Elastic search: query string specify decimal points

I have data stored in ES as a double format. At UI, its value is displayed with two decimal points.

For eg. 0.33182782258064514 is shown as 0.33

When user does some filtering like equals filter then it sends 0.33 to the ES query via query string fieldname:0.33

This query fails because of difference in decimal points. Is there any way to specify that ES query should use 2 decimal points so that it will work

Upvotes: 1

Views: 1204

Answers (1)

Val
Val

Reputation: 217314

Double fields are precise. 0.33 is not 0.33182782258064514 even though it displays as 0.33 for convenience purposes.

How about specifying a range in your query string such as this one?

fieldname:[0.33 TO 0.34}

or

fieldname:>=0.33 AND fieldname:<0.34

Upvotes: 2

Related Questions