How to build Kibana plugin of the discover view, without aggregation

We have been trying to build several kibana plugin following tim roes's guide and look around the existing plugins.

It seems that all visualization plugin requires aggregation, and for us, we want to make a new plugin that can display search result differently (without aggregation). This is similar to saved search, that can also be added to dashboard.

I have found some comments of using following code, it can retreieve data but not sure if this will impact the other behaviors like save plugin or interact properly in the dashbaord with other plugins.

    var searchSource = new SearchSource();
    searchSource.size(500);
    searchSource.index($scope.vis.indexPattern);
    searchSource.onResults().then(function onResults(searchResp)

Is this the "proper" implementation, meaning not hacking through the kibana code for other features like save, load, options etc.

This is also a bit, what I requested in the following topic: Making custom ES queries form a Kibana plugin

I think your use case, should be on the Dashboard page not the discover, but won't need aggregations, but should be linked to filters, query, time range, etc. This is exactly what I asked for in the other topic. Please also comment there if you wish a feature like that :slight_smile:

You are right, Tim. The end goal is to add into Dashboard. Dashboard only allows visualization or saved search. We can only build visualization plugin (and apps) right now, but I just want to clarify the need is to visualize search result, not aggregated result count.

By the way, thanks for the article you wrote on kibana plugin. I have been following those steps, appreciate it.

Hi, Xiaodong

I have met the same problem like you and Tim.
I noticed the code you mentioned above:
var searchSource = new SearchSource();
searchSource.size(500);
searchSource.index($scope.vis.indexPattern);
searchSource.onResults().then(function onResults(searchResp)

Could you please post the whole code here?
And please also comment here if you get the solution. Thanks.