Vega histogram does not work in Kibana

I tried to create histogram based on the variable "battery_temp_mean", but it shows an error "Cannot read property 'origins' of undefined". If I removed the format line, it shows another error "Cannot read property 'battery_temp_mean' of undefined". Could you please tell me what is the problem? Thanks in advance.

{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"title": "Distribution of Mean Voltage",
"data": {
"url": {
"%context%": true,
"index": "guobiao_daily_stats*",
"body":{
_source:["battery_temp_mean"]
}
}
"format": {"property": "aggregations.origins.buckets"}
},
"mark": "bar",
"encoding": {
"x": {
"bin": true,
"field": "_source.battery_temp_mean",
"type": "quantitative"
},
"y": {
"aggregate": "count",
"type": "quantitative"
}
}
}

@vernal,

could you first check if your ES query is actually returning the JSON you expect to see?

I would suggest you try out your ES-query first in the dev-console of Kibana. Once you have it working, bring it over to the Vega-visualization.

Thanks! How to check if the ES query is actually returning the JSON? What command I should use?

hi @vernal,

what you'll want to use is the dev-console application in Kibana. It allows you to run your queries against Elasticsearch. For more info, see here https://www.elastic.co/guide/en/kibana/current/console-kibana.html

Then, after you have your ES-query working, you can paste the body of your query in the body property of the Vega-markup.

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