I have a solution to this problem. Similar to the answer given by @OmarOthman, but without the above problems, namely:
If the information aggregated in the array is not possible, it is that the Elastic team hasn't done it yet .
You will need to disaggregate the documents in separate documents, one with each array value. You can use the parent documents elastic features to collect them.
- Once you have documents with this form:
Disaggregated form:
{ "_datetime" : "2014-03-21 10:10:10", "bytes_sent": 12312, "bytes_received" : 123123 } { "_datetime" : "2014-03-21 10:10:11", "bytes_sent": 12310, "bytes_received" : 12313 }
instead:
[β¦] "_datetime" : "2014-03-21 10:10:10", "showstatus": [ { "value": 96451, "variable_name": "bytes_sent" }, { "value": 435322, "variable_name": "bytes_received" } ] } [β¦]
You can make several series in Timelion, for example @OmarOthman, but you can also add a secondary (and even tertiary) Y axis using the yaxis Timelion method, for example:
.es('avg:bytes_sent').yaxis(1, label='Bytes sent').bars(), .es('avg:bytes_received').yaxis(2, label='Bytes received', positon='right').bars()
Using the bars method, you can draw it as a histogram of a date.
Another approach suggested by @OmarOthman will only show the average value taking all the βvaluesβ from all documents in the showstatus array. This is because the request 'showstatus.variable_name: bytes_sent' is always true, because all documents have this "variable name" in their showstatus array. Therefore, both series would be the same if in some documents there wasnβt the byte_center variable_name inside the showstatus array. Try to draw it, it does not work as expected.
Carlos Vega
source share