Vega visualisation

Hello everyone,

I would like to make an online visualization using some fields of my document which looks like this:

"otherFieldA" : "...",
"otherFieldB" : "...",
"otherFieldC" : "...",
"mainField" : [
            {
              "_id" : ".....",
              "fieldA" : "....",
              "fieldB" : "....",
              "fieldC" : "date",
              "fieldD" : ...,
              "fieldE" : ...
            },
           {
              "_id" : ".....",
              "fieldA" : "....",
              "fieldB" : "....",
              "fieldC" : "date",
              "fieldD" : ...,
              "fieldE" : ...
            },
            {
              "_id" : ".....",
              "fieldA" : "....",
              "fieldB" : "....",
              "fieldC" : "date",
              "fieldD" : ...,
              "fieldE" : ...
            }
]

I would like to access the fields in mainField when I do a Vega visualization.

Thanks in advance for your help and feedback.

Typically you will need to flatten an array using a transformation to access data within.

1 Like

Is the transformation done when I write the code for the vega visualization or upstream?

And what kind of transformation do I have to do to keep everything consistent?

for example, that the field C "date" of the first object corresponds to the field A of the first object ?

Thank you in advance for your answer!

It's in the Vega code. You can load the data into Vega and then transform. See this example to get an idea. Open up the data viewer and you see the data and the transformation.

Thank you for your answer,

the problem is that I have thousands of entries so I don't think I can put this in a table by hand.

Would you have another solution for my case?

Thank you in advance for your future feedback

Please check out the Vega documentation. I hardcoded the data above for an example but you can still pull your data from an index.

Maybe load the demo data that comes with Kibana and view those Vega visualizations to see what's possible.

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