title: How to round up double to 2 decimal point - elasticsearch
body: <p>I have documents in elastic search that looks like : </p>
  
  <pre><code>{
                  "entityFk": 0,
                  "entityCode": "ADM",
                  "entityObj": {
                      "id": 0,
                      "code": "ADM",
                      "description": "ADM - FIRSTCOM"
                  },
                  "practiceFk": 54745,
                  "practiceObj": {
                      "id": 54745,
                      "code": "33.04.01.32",
                      "description": "Artrotomia ou artroscopia com tratamento de lesões articulares circunscritas  ",
                      "practiceValue": 23.5
                  }
              }
          }
  </code></pre>
  
  <p>I want to sum all "practiceValue" (not null) that has entityCode.description equals to "FIRST", so I made this query : </p>
  
  <pre><code>    {
      "size" : 0,
      "query" : {
          "bool" : {
              "must_not" : [
                  {
                      "missing" : { "field" : "practiceObj.practiceValue" }
                  }
               ],
               "must" : [
                  {
                      "match" : { "entityObj.description" : "FIRST" }
                  }
               ]
           }
      },
      "aggs" : {
          "total" : {  
              "sum" : { "field" : "practiceObj.practiceValue"} 
  
          }
      }
  }
  </code></pre>
  
  <p>Here is the result I obtained : </p>
  
  <pre><code>   {
      "took": 26,
      "timed_out": false,
      "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
      },
      "hits": {
          "total": 11477,
          "max_score": 0,
          "hits": []
      },
      "aggregations": {
          "total": {
              "value": 1593598.7499999984
          }
      }
  }
  </code></pre>
  
  <p>The deal is: how can i round up the value to 2 decimal point.
  Can someone help?
  Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>here´s my mapping : </p>
  
  <pre><code> {
      "index_practice_entities": {
          "mappings": {
              "practice_entities_search": {
                  "properties": {
                      "entityCode": {
                          "type": "string"
                      },
                      "entityFk": {
                          "type": "long"
                      },
                      "entityObj": {
                          "properties": {
                              "code": {
                                  "type": "string"
                              },
                              "description": {
                                  "type": "string"
                              },
                              "id": {
                                  "type": "long"
                              }
                          }
                      },
                      "practiceFk": {
                          "type": "long"
                      },
                      "practiceObj": {
                          "properties": {
                              "code": {
                                  "type": "string"
                              },
                              "description": {
                                  "type": "string"
                              },
                              "id": {
                                  "type": "long"
                              },
                              "practiceValue": {
                                  "type": "double"
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>