# What's the efficient way to filter and transfer data from Elastic

**URL:** <https://discuss.elastic.co/t/whats-the-efficient-way-to-filter-and-transfer-data-from-elastic/335006>\
**Category:** Elasticsearch\
**Created:** [June 1, 2023, 3:14pm UTC](https://discuss.elastic.co/t/whats-the-efficient-way-to-filter-and-transfer-data-from-elastic/335006 "2023-06-01T15:14:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monkey\_D\_Luffy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monkey_d_luffy1/32/119071_2.png) [@Monkey\_D\_Luffy1](https://discuss.elastic.co/u/Monkey_D_Luffy1)\
**Post date:** [June 1, 2023, 3:14pm UTC](https://discuss.elastic.co/t/whats-the-efficient-way-to-filter-and-transfer-data-from-elastic/335006/1 "2023-06-01T15:14:54Z")

</div>

I have an Elastic Index which has 100 million documents inside it and I want to understand whats the efficient way of writing a python script to filter values and then transfer the filtered values to a SQL storage ?

---

<div class="post-metadata">

**Author:** ![eMitch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emitch/32/93607_2.png) [@eMitch](https://discuss.elastic.co/u/eMitch)\
**Post date:** [June 5, 2023, 1:23pm UTC](https://discuss.elastic.co/t/whats-the-efficient-way-to-filter-and-transfer-data-from-elastic/335006/2 "2023-06-05T13:23:43Z")

</div>

Hey @Monkey_D_Luffy1 and welcome to the community!

Using [elasticsearch-py](https://elasticsearch-py.readthedocs.io/en/v8.8.0/api.html?highlight=search_after#elasticsearch.Elasticsearch.search), you can perform your search with filters. Since you may have many documents, you will want to use `search_after` in order to [paginate through them](https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after).  
With each response, you can format your docs and write them into your preferred database.

---

<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:** [July 3, 2023, 1:24pm UTC](https://discuss.elastic.co/t/whats-the-efficient-way-to-filter-and-transfer-data-from-elastic/335006/3 "2023-07-03T13:24:26Z")

</div>

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