# I can't load all documents from csv file using python

**URL:** <https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [May 23, 2022, 4:56pm UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419 "2022-05-23T16:56:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![safaeaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/safaeaz/32/105379_2.png) [@safaeaz](https://discuss.elastic.co/u/safaeaz)\
**Post date:** [May 23, 2022, 4:56pm UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419/1 "2022-05-23T16:56:51Z")

</div>

i'm trying to load csv file to Elasticsearch using python

```auto
from elasticsearch import Elasticsearch, helpers
import csv

# Elastic search configuation

es = Elasticsearch('http://IP:8081')

# Creating index
es.indices.create(index="suivipsi")

# Looking if the index exists
#es.indices.exists(index="firstindex")

# Open csv file and bulk upload
with open('Suivi_des_PSI_2.csv',encoding='utf-8') as f:
    reader = csv.DictReader(f)
    helpers.bulk(es, reader, index='suivipsi')

```

my csv file hase 8793 line but when index is created in elasticseach i found that just 334 document loaded

 ![psi](https://us1.discourse-cdn.com/elastic/original/3X/1/4/14b21443556b829a9ee249ea1b1e3b5f4804f7fe.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 24, 2022, 12:23am UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419/2 "2022-05-24T00:23:53Z")

</div>

You probably want to check the response from Elasticsearch to see if there are any errors.  
You can also check the Elasticsearch logs to see if there's anything there that might provide some hints.

---

<div class="post-metadata">

**Author:** ![safaeaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/safaeaz/32/105379_2.png) [@safaeaz](https://discuss.elastic.co/u/safaeaz)\
**Post date:** [May 24, 2022, 5:01pm UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419/3 "2022-05-24T17:01:00Z")

</div>

@warkolm i found that he can load empty date documents is there a way to load that lines eventhought they are empty !!!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 24, 2022, 10:45pm UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419/4 "2022-05-24T22:45:40Z")

</div>

You will need to provide a date in there for it to be accepted.

---

<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:** [June 21, 2022, 10:46pm UTC](https://discuss.elastic.co/t/i-cant-load-all-documents-from-csv-file-using-python/305419/5 "2022-06-21T22:46:35Z")

</div>

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