I've created an elasticsearch index and my current mapping stores the dollar amount of an item as a string. This is proving to be difficult as I can't search/filter on this value correctly.
GET catalog/product/_search
{
"filter": {
"range": {
"price": {
"from": 230.0,
"to": 300.0
}
}
}
}
Where price is mapped as a string. I used a string because going from a python decimal value, I've had issues where this value suddenly gets values at something like 17.989999999999999999998789. This only happens sometimes but I don't wanna get into the issue of going from a python decimal to a java double/float (so I just str() the thing).
Any thoughts on a better approach? Should I bite the bullet and map the price to a double or a float?