# How to get content of document in Kibana plugin

**URL:** <https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837>\
**Category:** Kibana\
**Created:** [July 20, 2018, 6:12am UTC](https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837 "2018-07-20T06:12:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bamboo2222](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@bamboo2222](https://discuss.elastic.co/u/bamboo2222)\
**Post date:** [July 20, 2018, 6:12am UTC](https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837/1 "2018-07-20T06:12:07Z")

</div>

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.

```
  server.route({
    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]'
      }).then(function(response){
        reply(response.data);
      });
    }
  });

```

Can anyone give me some advice? Thanks!

---

<div class="post-metadata">

**Author:** ![a5a](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@a5a](https://discuss.elastic.co/u/a5a)\
**Post date:** [July 20, 2018, 2:54pm UTC](https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837/2 "2018-07-20T14:54:06Z")

</div>

Hi,

Let's troubleshoot why you're getting nothing back. Is the `response` empty? Or `response.data`? 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.

---

<div class="post-metadata">

**Author:** ![bamboo2222](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@bamboo2222](https://discuss.elastic.co/u/bamboo2222)\
**Post date:** [July 23, 2018, 1:23am UTC](https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837/3 "2018-07-23T01:23:40Z")

</div>

Thanks for your advice, I do get more information. The `response.data` 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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 20, 2018, 1:23am UTC](https://discuss.elastic.co/t/how-to-get-content-of-document-in-kibana-plugin/140837/4 "2018-08-20T01:23:46Z")

</div>

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