Long value displayed incorrectly in watcher email

Hi,

I have created runtime field using a field price(type is float). The runtime field is a long type field.

"runtime_mappings": {
            "longPrice": {
              "type": "long",
              "script": """
			        long value = (long)doc['price'].value;
				    emit(value);
			    """
            }
          }

When I am trying to aggregate on the runtime field, the result still be treated as float value. As the aggregated value is not in float range, the value is displayed incorrectly.

"aggs": {
	"store": {
		"terms": {
			"field": "storeID"
		},
		"aggs": {
			"totalPrice": {
				"sum": {
					"field": "longPrice"
				}
			}
		}
	}
}

SearchResult Snippet:

"aggregations" : {
    "store" : {
      "doc_count_error_upper_bound" : 2246,
      "sum_other_doc_count" : 441896,
      "buckets" : [
        {
          "key" : "1234",
          "doc_count" : 9882,
          "totalPrice" : {
            "value" : 4585792.0
          }
        },
        {
          "key" : "1235",
          "doc_count" : 8233,
          "totalPrice" : {
            "value" : ***1.3391005E7***
          }
        },
        {
          "key" : "1236",
          "doc_count" : 5205,
          "totalPrice" : {
            "value" : 413264.0
          }
        },
        {
          "key" : "1237",
          "doc_count" : 5013,
          "totalPrice" : {
            "value" : 1000374.0
          }
        },
        {
          "key" : "1238",
          "doc_count" : 4544,
          "totalPrice" : {
            "value" : ***3.221301E7***
          }
        }
      ]
    }
  }

If we see the second and fifth bucket value, they are displaying incorrectly.

What need to be changed for this?

Thanks In Advance

Regards,
Keyu

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