0's after decimal places are absent in elastic search

I have taken the type of a field in elastic search as double and while ingesting any value which has some 0's after decimal place then the 0's after decimal place is not shown. For example: for value 23.0 is converted to 23

PFB the mapping which I have used:

curl -X PUT "localhost:9200/test" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "abc": {               
      "properties": {            
        "price": {
          "type": "double"
        },
        "mrp": {
          "type": "long"
        }
      }
    }
  },
  "settings": {
     "index.mapping.coerce": false
  }
}'

I expect output for 23.0 to be exactly the same which is 23.0 itself and for integer values I also exppect 23 to be converted itself to 23.0 Please provide an appropriate solution.

Using elastic search version 6.5.0

Why do you want to store the zero? What is your usecase?

My guess is: It works as designed as the value "23" is stored as double in ElasticSearch while "23.0" or even "23.00000" is the same value in a different format.

What output are you referring to?

Output : Data which is seen in my index

What API are you calling? What exactly are you referring to?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.