Vega-lite histogram

Hi,
I would like to plot a histogram from a data set that includes many documents, and in each document there is an error value.
the histogram should display the count of documents per each binned error values.
I tried the following script but it didnt work.
any idea?

{
  $schema: https://vega.github.io/schema/vega-lite/v2.json

  data: {
    data: table
    url: {
      %context%: true
      %timefield%: StartTime
      index:measure-data*

      body: {
        size: 10000
        _source: ["Type","error"],

      }
    }

  }
  transform: [
{"filter": {"field": "_source.Type", "equal": "Calibration"}}
      ]  ,
  mark: {type: "bar"}
encoding: {

    "x": {
      "bin": true,
      "field": "_source.error"
    },
    "y": {"aggregate": "count"}

}

}

This type of chart can easily be created with the regular visualization types and doesn't require vega. Also, by loading the individual documents into the browser to do the binning the chart is less efficient than it could be - by using Elasticsearch side aggregation capabilities, load on all components (Elasticsearch, Kibana server and your browser) is reduced.

1 Like

What is Lens visualization?
I don't have this option:

Your Kibana version seems a little dated, you can either update or use the regular "Vertical bar" chart visualization.

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