I want to prefix this by recommending to not modify the Kibana source itself, but to instead implement things lika that as a plugin that provides a new visualization type.
That being said, what you are probably looking for is to get hold of the SearchSource and use the body property of the SearchSource._flatten() call's return value.
Doing this as a plugin is an interesting idea - working on plugin should improve maintenance. Can you please point me to an example plugin which uses SearchSource ?
The visualization type infrastructure provides an extensive abstraction over data retrieval and dashboard embedding. Since all built-in visualization are implemented as plugins as well, I would recommend to look at one of them (e.g. the data table visualization). Maybe you could copy the visualization, rename it and adapt it to your use-case. Unfortunately there is no authoritative documentation on writing visualization plugins, but there are several community-authored tutorials such as https://www.timroes.de/2015/12/06/writing-kibana-4-plugins-visualizations-using-data/. The official documentation also contains an overview of the basic structure of a plugin.
I read the official documentation of plugin development and everything I could find online, and SearchSource does look like what need - but I'm still not sure how to use it. Could you point me to an example of how to "get a hold of SearchSource" ?
expecting finally to see my query logged in the console, whereas instead I'm getting the following error...help..please
angular.js:12477 TypeError: Cannot read property 'index' of undefined
at SourceAbstract.AbstractDataSourceProvider.SourceAbstract.get (_abstract.js:90)
at _root_search_source.js:17
at SourceAbstract.SearchSourceProvider.SearchSource._mergeProp (search_source.js:172)
at ittr (_abstract.js:316)
at index.js:2275
at index.js:3073
at baseForOwn (index.js:2046)
at index.js:3043
at baseMap (index.js:2274)
at Function.map (index.js:6710)
at ittr (_abstract.js:309)
at _abstract.js:324
at processQueue (angular.js:14745)
at angular.js:14761
at Scope.$eval (angular.js:15989)
at Scope.$digest (angular.js:15800)
You're trying to call the instance method _flatten() without and instance by accessing the prototype directly. In order to use the search source you have to get hold of an instance. You can either create your own using something like
const SearchSource = Private(SearchSourceProvider);
const searchSource = new SearchSource();
AFTER
TypeError: Cannot read property 'timeFieldName' of undefined
at Timefilter.get (timefilter.js:87)
at _root_search_source.js?422d:17
at SearchSourceProvider.SearchSource._mergeProp (search_source.js?5034:172)
at ittr (_abstract.js?851d:316)
at index.js:2275
at index.js:3073
at baseForOwn (index.js:2046)
at index.js:3043
at baseMap (index.js:2274)
at Function.map (index.js:6710)
at ittr (_abstract.js?851d:309)
at _abstract.js?851d:324
at processQueue (angular.js:14745)
at angular.js:14761
at Scope.$eval (angular.js:15989)
at Scope.$digest (angular.js:15800)
(anonymous) @ angular.js:12477
(anonymous) @ angular.js:9246
processQueue @ angular.js:14753
(anonymous) @ angular.js:14761
$eval @ angular.js:15989
$digest @ angular.js:15800
$apply @ angular.js:16097
(anonymous) @ angular.js:23554
dispatch @ jquery.js:4737
elemData.handle @ jquery.js:4549
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.