9

I have a few million documents in an ElasticSearch index with some numeric fields, say foo and bar. Is there any way to use Kibana 4 to create a graph with foo values on the X axis and bar values on the Y axis? Like a very, very basic chart one might create using Excel.

I'm fine with sampling/aggregations of some kind. I understand that these tools won't show me a plot with 20 million data points. I'm just trying to see if there's some obvious relationship between foo and bar by creating a graph.

2 Answers 2

5

To just plot the correlation between revenue and employee count I would just use a line chart like this:

simple line chart

In order to justify creating a scatter plot chart though (since they're awesome and I wanted to) I generated some fake data that looked something like this:

{
  name: faker.company.companyName(),
  employees: _.random(3, 30),
  revenue: _.random(10000, 100000),
  industry: _.sample(industries)
}

And plotted it in visualize by breaking it down piece-by-piece:

  1. Start with a line chart
  2. Switch to Options tab of sidebar (since 4.1)
    • Uncheck "Show Connecting Lines"
    • Check "Scale Y-Axis to Data Bounds"
  3. Switch back to the Data tab
  4. Modify the "Y-Axis"
    • use the Average aggregation
    • on the employees field
  5. Add a "Dot Size" metric
    • use the Unique Count aggregation
    • on the company field
  6. Add a "Split Lines" bucket
    • use the Terms aggregation
    • on the industry field
    • I like to set the size close to the cardinality of my data
  7. Add an "X-Axis"
    • use the Histogram aggregation
    • on the revenue field
    • guess an interval, you will need to play with this a bit
  8. Finally, click Apply

This configuration is pretty complex, but the resulting visualization shows a lot of information.

scatter plot

1
  • Does Kibana support any interactivity with the plotted points/glyphs beyond a hover tool like you graciously included with the last screen shot? For example can one click on a point and have it serve as link opening up a view focused in on that data point? I'm looking for something analogous to Bokeh's TapTool functionality, which is basically click a point with subsequent callback.
    – jxramos
    Jul 11, 2019 at 23:14
0

I found a hack for this.

  1. Create a line chart
  2. X axis is a Terms aggregation of foo
  3. Add sub-aggregation (Split Lines) on the same field
  4. Y Axis is sum of your other column (bar)

I don't see any way of making the legend meaningful, though

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.