# Continuously get data from Elasticsearch, when new poll data comes in

**URL:** <https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254>\
**Category:** Kibana\
**Tags:** kibana-plugin-development, data-views\
**Created:** [July 26, 2023, 6:06am UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254 "2023-07-26T06:06:36Z")\
**Posts on this page:** 5\
**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:** [July 26, 2023, 6:06am UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254/1 "2023-07-26T06:06:36Z")

</div>

Hi,

I am creating an external plugin in Kibana 8.1.1 using React.

I am retrieving the data I have in ES using the data plugin. Is it possible to fetch and update the plugin state as and when data is inserted into the index, rather than have to call the retrieval function every 2 minutes?

Thanks

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [July 27, 2023, 2:18pm UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254/2 "2023-07-27T14:18:00Z")

</div>

Hi there, no Elasticsearch doesn't provide any push event for data added to the index.  
This could translate to sending all the data to the client that could become unsustainable depending on the ingestion load.  
Polling is the way to handle that right now. Depending on your data queries, you can probably also increase the frequency of the polling and reduce the fetched data just to the interval between the current time and the last call time, appending the data to the previous one.

---

<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:** [August 8, 2023, 5:57am UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254/3 "2023-08-08T05:57:47Z")

</div>

Thanks for the reply

So every 2 mins (poll interval) I have to call a retrieval function (using searchSource, query, or search functionalities of data plugin - [https://github.com/elastic/kibana/blob/8.9/src/plugins/data/README.mdx](https://github.com/elastic/kibana/blob/8.9/src/plugins/data/README.mdx) ) within my plugin to fetch the last polled data?

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [August 21, 2023, 8:22am UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254/4 "2023-08-21T08:22:56Z")

</div>

Correct, or as described in the documents you linked you can set the auto-refresh interval to 2 minutes

---

<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:** [September 18, 2023, 8:23am UTC](https://discuss.elastic.co/t/continuously-get-data-from-elasticsearch-when-new-poll-data-comes-in/339254/5 "2023-09-18T08:23:11Z")

</div>

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