How to create a line chart from object in array in ElasticSearch


(Mukesh Kumar Mohanty) #1

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?


(Spencer Alger) #2

The pattern of storing documents within other documents is commonly referred to as "nested documents", and unfortunately Kibana does not support it.

In order to visualize these documents in Kibana they will need to be indexed as their own events:

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

(Mukesh Kumar Mohanty) #3

Make sense to me if its not supported, I thought there might be some kind of hack to flatten this objects to array. Do you know if any near future kibana will support this.


(Spencer Alger) #4

I wouldn't count on it


(Mukesh Kumar Mohanty) #5

Hi, Now I created the flat mapping as recommended by you, but can't able to filter analyticValue based upon analyticId. In Y axis I can choose analyticValue but couldn't find filter option there. Could you shed some light on this.


(Peter Pisljar) #6

Not sure if I understand you correctly, but filters should be applied in the filter bar not on the metrics.

If you type something like analyticId: B in your query bar it should only select that data.

Or you could add another visualization, like pie and split it by analyticsId. you would get a pie chart with A, B, C (the most common ids).
Now if you put this pie chart on the same dashboard you have your chart where you plot analyticsValue, you can click a slice and it will apply filter so your value chart will get instantly updated with just those values.


(system) #7

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