# Upsert data in ElasticSearch using python dataframes

**URL:** <https://discuss.elastic.co/t/upsert-data-in-elasticsearch-using-python-dataframes/202841>\
**Category:** Elasticsearch\
**Created:** [October 9, 2019, 1:48pm UTC](https://discuss.elastic.co/t/upsert-data-in-elasticsearch-using-python-dataframes/202841 "2019-10-09T13:48:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![myrtod](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@myrtod](https://discuss.elastic.co/u/myrtod)\
**Post date:** [October 9, 2019, 1:48pm UTC](https://discuss.elastic.co/t/upsert-data-in-elasticsearch-using-python-dataframes/202841/1 "2019-10-09T13:48:06Z")

</div>

Hi all !

I am using python to read a csv, transform it and then load it in ElasticSearch (using Espandas).  
Given the mapping, I wish to add some more data from other csvs, as fields.

For example, suppose I have a csv with columns "id" and "value" and an index consisting of col\_id ( = doc\_id), colA, colB and colC.  
I wish to upsert the "value" data from the csv in colC, while matching the index of ElasticSearch (col\_id = doc\_id) and the index column in the csv col\_id.

So far I have only found solutions mentioning the doc\_id which should be updated, but I am interested in loading a whole dataframe and upserting all of its data at once and not one-by-one.

Any ideas ?? Thanks in advance !

---

<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:** [November 6, 2019, 1:48pm UTC](https://discuss.elastic.co/t/upsert-data-in-elasticsearch-using-python-dataframes/202841/2 "2019-11-06T13:48:16Z")

</div>

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