# How can I get elasticsearch indices, dataviews, documents inside my Kibana plugin?

**URL:** https://discuss.elastic.co/t/how-can-i-get-elasticsearch-indices-dataviews-documents-inside-my-kibana-plugin/324901
**Category:** Kibana
**Tags:** kibana-plugin-development
**Created:** [February 7, 2023, 1:11pm UTC](https://discuss.elastic.co/t/how-can-i-get-elasticsearch-indices-dataviews-documents-inside-my-kibana-plugin/324901 "2023-02-07T13:11:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [February 7, 2023, 1:11pm UTC](https://discuss.elastic.co/t/how-can-i-get-elasticsearch-indices-dataviews-documents-inside-my-kibana-plugin/324901/1 "2023-02-07T13:11:17Z")

</div>

Hi,

I an creating an external plugin in Kibana 8.5.3.

How can I get data/docs/indices/dataviews/... from my elasticsearch instance within my plugin?

Thanks

---

<div class="post-metadata">

### Author: ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)
#### Post date: [February 10, 2023, 7:45pm UTC](https://discuss.elastic.co/t/how-can-i-get-elasticsearch-indices-dataviews-documents-inside-my-kibana-plugin/324901/2 "2023-02-10T19:45:10Z")

</div>

Hi Sheereen, if you have elasticsearch data located in the `.data` folder already, then you should be able to view that using elasticsearch API request from the [Console app (dev tools)](https://www.elastic.co/guide/en/kibana/8.5/console-kibana.html#console-kibana) in kibana's main application.

If you then want to [build on top](https://www.elastic.co/guide/en/kibana/8.5/development-plugin-resources.html#development-plugin-resources) of that data, which it seems like you do, then you can use the elasticsearch service from the context in your [plugin's setup and start contracts](https://www.elastic.co/guide/en/kibana/8.5/kibana-platform-plugin-api.html#plugin-lifecycles).

The docs for the Core APIs cover how to use them: [Kibana Core API | Kibana Guide [8.5] | Elastic](https://www.elastic.co/guide/en/kibana/8.5/kibana-platform-api.html) and the suggested [patterns](https://www.elastic.co/guide/en/kibana/8.5/patterns.html#scoped-services) to follow are discussed in these docs.

To use services from another kibana plugins (like dataviews for example), there's a great post that explains what approach to take and some examples you can look at [here](https://discuss.elastic.co/t/how-to-use-kibana-api-in-plugin-development/291131/2)

---

<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: [March 10, 2023, 7:45pm UTC](https://discuss.elastic.co/t/how-can-i-get-elasticsearch-indices-dataviews-documents-inside-my-kibana-plugin/324901/3 "2023-03-10T19:45:30Z")

</div>

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