Search code examples
elasticsearchplotgraphkibanakibana-4

How to create a line chart based upon column value instead of column name in Kibana


In ElasticSearch I have some sample data, against which I would like to visualize the line charts in Kibana 4. Samples in ElasticSearch look like this:

    "_id": "AVhNy_dxcW7axK5BvIEO",
    "timeStamp": "2016-11-11T05:39:10.5844951Z",
    "analyticSource": [
                      {
                         "analyticId": "A",
                         "analyticUnit": "sec",
                         "analyticValue": 0.22743704915046692
                      },
                      {
                         "analyticId": "B",
                         "analyticUnit": "sec",
                         "analyticValue": 0.14946113526821136
                      }]

and another sample:

    "_id": "AVhNxnjscW7axK5Bu-Tl",
    "timeStamp": "2016-11-11T05:40:10.5954951Z",
    "analyticSource": [
                      {
                         "analyticId": "A",
                         "analyticUnit": "sec",
                         "analyticValue": 0.20143736898899078
                      },
                      {
                         "analyticId": "B",
                         "analyticUnit": "sec",
                         "analyticValue": 0.09747125953435898
                      }]

For now Kibana just plot plot according to the column Id and in this case a single line chart is plotted for analyticValue. What I really want is to plot 2 line chart in Kibana for A and B against timestamp. Is there some kind of script(query) or something where I can say to kibana to seggregate the analyticValue according to analyticId?


Solution

  • Object to array is not suppported on Kibana 4. So I have to create the flat mapping with analyticId, analyticValue, analyticUnit as columnns. Then I aggregate over analyticId and created the line chart with Y axis as max of analyticValue and in X axis selected Date Histogram with time-stamp. I hope this helps to users who lands here.