I'm
I'm trying to use the script field and I started with an existing field.
The value of the script field is different from the value of the field itself.
I'm using metricbeat "system.cpu.idle.pct" and have defined a script field for it as well: doc['system.cpu.idle.pct'].value
Their values are not matching.
Here is the request body and the screenshot.
Would you please kindly help me? What am I doing wrong?
The problem is the value that is returning is from a different scale that the actual value.
On the screenshot that I have posted the scripted field has values but they are too small.
{
"took": 277,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 19437,
"max_score": 0,
"hits": []
},
"aggregations": {
"1": {
"value": 0.00251582034264547
}
}
}
Would you please kindly let me know how I can open a bug on Kibaba scripted field?
If I delete the metricbeat index and recreate it with your steps and run the command then the result is correct.
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 0,
"hits": []
},
"aggregations": {
"1": {
"value": 0.035
}
}
}
However the problem is that metricbeat is the one collecting data for me and this does not work with the data collected from the beat.
I've found the solution and the reason this strange behaviour happens.
If I create the visualization over the "cpu stat" search instead of the index itself it will give me the correct result.
Taking a look at the request that is sending you'll see this:
The search filters if there is no value for the field and do not set it to value 0.
The metrics beat does not send values for all the timeslots. The timeslots that do not have the fields value will get the value zero for the script field. The search solves this by putting a filter.
I think This is not a bug on elasticsearch/ kibana. But metric beat should warn the users that this can happen using the script fields over the index itself.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.