I am getting incorrect sum using aggregation from kibana visualization

I am am having a document as shown in image

Mappning : "busyTime": { "type": "long" }

The above code snippet is an example.

On my actual production server, I am not getting the correct sum of the busy time, As per my understanding it is not considering float values it only add numbers before decimal only.

Why this is happening any help can be appreciable.

[{
	"machinename":"Rama_desktop",
	"busyTime": 3.42,
	freeTime:20.58
	"location": "Beed"
	
},
{
	"machinename":"soni_desktop",
	"busyTime": 11.3,
	"freeTime": 12.7,
	"location": "Beed"
},
{
	"machinename":"raja_desktop",
	"busyTime": 22.8,
	"freeTime": 1.18,
	"location": "Beed"
}

]```

Given the fact you're using long as type of busyTime, the aggregation is done as long.

What you see in the document (e.g. busyTime of 3.42) is the _source.

Aggregations are done on the type which got indexed.

You can see the indexed value doing:

GET <index name>/_search
{
  "docvalue_fields": ["busyTime"]
}

The best would be to reindex the data after fixing the type, which should be set to float or half_float (see Elasticsearch numeric datatypes).

1 Like

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