Vega select box aggregations

Hello,

I need to create a chart where Y axis can be changed based on a select box. I saw this example in Vega, but not sure how to replicate in Elasticsearch.

Link to visualization:

Vega Editor

thanks

1 Like

Hi Gustavo,

I was able to copy the configuration you linked to into Kibana's custom visualization editor without any hitches.

In case it's helpful, you can get to this editor from the dashboard you want to add the visualization to:

To get your visualization hooked up to your Elasticsearch data you can use an Elasticsearch query as the Vega datasource. Kibana extends Vega so that if you set "data.url" to an object instead of a string, it is interpreted as an Elasticsearch DSL query. See this doc for more details and for a comprehensive tutorial on building a custom visualization in Kibana.

After hooking up an Elasticsearch query, most of the work to build your custom visualization is using the Vega-Lite (or plain Vega) grammar (nothing Elastic-specific). However, it's worth noting that our custom visualization editor makes things a little more convenient by supporting Hjson in addition to JSON syntax.

If you're new to Vega-Lite, here is a good tutorial to get you started.

Let me know if this helps.

1 Like

Thanks @Andrew_Tate , precisely I need help with that data transformation but I will mark your answer as solution anyways because is fair enough to go and read a bit more.

1 Like

Sounds good, @Gustavo_Llermaly .

I need help with that data transformation

Does this mean you're looking for guidance on how to get Vega to use the response from your Elasticsearch query? If so, feel free to post it and I can take a look!

That would be awesome. I'm trying to reproduce it using the kibana ecommerce example data but I read you can not run a new query for each select change so you have to load everything in one query and then hide/show things. There is where I get lost. @Andrew_Tate

@Gustavo_Llermaly I see. Yes, I think you're right—we only support one initial request.

Go ahead and post

  • your specific query/queries (query DSL in a code block)
  • a description of what options you want to have appear in the select element
  • how exactly you want the graph to change when the selected value is updated.

I can't promise an outcome, but if you send me that info I can add the sample data to a cluster and see what I can do on my end. :+1:

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