Hello guys! I'm struggling to get the rows array from a data table visualization.
First of all: I want to avoid making request to elasticsearch from my backend and compose the result by myself cause I think I can reuse the existing data. I know how to fetch the same data and the query to be used but it's not my desired logic.
If I have one or more data tables vis already rendered into my view, Is there a way to get rows from the visualizations handler?
What I'm looking for is $scope.table.rows, so my question is How to access $scope.table.rows out of the Kibana directive code? I have the visualization object, the handler, etc ..
there is currently no option via the handler and vis loader to reach the data within the visualization. We are also not planning to add such an interface, since we have no knowledge about the data inside the visualization (if it is even using any), it might not be in a tabular format, etc.
Dirty workaround from 6.4 onwards!
There is a dirty workaround, that you can use, if you have access to the Vis instance, which I don't recommend and this might never work in a backward compatible manner. If you've got access to the Vis instance of that visualization, you can use the attached data adapter, which is used to log the data for the inspector and get your data from it, something like that:
vis.API.inspectorAdapters.data.getTabular()
Which would return a promise that resolves with a table of the data. But since we are not making any guarantee on this API the format might change in upcoming versions (though no current plans to do so).
Ok Tim thanks for your response. One more thing, Have you got a raw response parser implemented? I need to implement one by myself but I think you could have something into your code which parse an elastic raw response from a data table request...
you can try having a look at tabify which is what we are currenlty using. But you should neither consider that a public API. In fact we know we'll change the output format in one of the upcoming versions (https://github.com/elastic/kibana/issues/20197).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.