Access first location of _all in Visual Builder markdown

(Rouble) #1

This topic is associated to the open issue of creating drill down dashboards in Kibana:

What follows is an attempt to workaround this open issue, but ultimately hitting a brick wall. Hopefully some brave kibana guru can help me out. I am trying to create hierarchical (or drill down) dashboards in kibana. To that end, to drill down at a certain level, I needed two pieces of hierarchical information. So, I configured the data section of the Visual Builder to send me data from two separate series combined (in the special _all field) as follows:

1. partner: {last: {…}, data: {…}, label: "Verizon"}
2. customer1: {last: {…}, data: {…}, label: "BA"}
3. customer2: {last: {…}, data: {…}, label: "AA"}
4. customer3: {last: {…}, data: {…}, label: "United"}

The first entry is from a different series and gives me the partner name. The second to fourth entry is from another series and gives me the customer names.

In my markdown, I want to create links for just the customers as follows:

[BA]( _a=(language:lucene,query:'partner:Verizon AND customer:BA'
[AA]( _a=(language:lucene,query:'partner:Verizon AND customer:AA'
[United]( _a=(language:lucene,query:'partner:Verizon AND customer:United'

This should be achievable using the following simple markdown code (according to the handlebars js documentation):

{{#each _all}}
  {{#if @first}}  
      [{{label}}](,query:'partner:{{_all.[0].label}} AND customer:{{label}}')

However, I have played with the handlebars implementation of Visual Builder for quite some time today, and there seems to be no way to get the label of the first location of _all dictionary in this way (or any other way). Any tips appreciated.

Note, I know how to get the first entry of _all by iterating over it, but I need it available while iterating all the other entries.

(Brandon Kobel) #2

Hey @rouble, I'm not seeing a way to do what you're trying to accomplish either. Handlebars will allow us to access the "parent context" using an expression like "../_all" which will let us reference the "_all" variable from the #each helper, but we're unable to grab the first element because _all is an Object not an Array, and I'm not seeing any handlebars syntax to access the first property value of an object.

(Rouble) #3

Thank you @Brandon_Kobel. Your findings are similar to mine. My thoughts here are that if the Kibana's Visual Builder provided another special variable, but one that is indexable like an array, say _all_Indexed, we can solve this longstanding, and in some cases, show stopping issue with very minor effort The index can simply be the label name of the series.

If users can combine different series of data, they uniquely index into them within markdown, they can build all types of drill down visualizations.

(system) #4

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