How to get content of document in Kibana plugin


Preformatted textHi, I'm developing custom kibana plugin, and try to retrieve document using the Elasticsearch JS method "GET", but get nothing. I have some questions about how to fetch content from the "response", and my code is like this.

    path : '/api/log-analysis/data',
    method: ['POST', 'GET'],
    handler: function(request, reply){
      const { callWithRequest } = server.plugins.elasticsearch.getCluster('data');
      callWithRequest(request, 'get', {
        index: '[my index]',
        type: '[my type]',
        id:  '[my id]'

Can anyone give me some advice? Thanks!

(Archana ) #2


Let's troubleshoot why you're getting nothing back. Is the response empty? Or I would also check Elasticsearch logs to see activity, and whether there's an error given back. You can also catch errors in your handler.


Thanks for your advice, I do get more information. The is null and the response is not null. There are no errors given back. I think I may set the parameters wrong, and I'm trying to fix it. Could you let me know if you have more suggestions, thanks. :slight_smile:

(system) #4

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