# Lossing the rest documents when BulkIndexError occured

**URL:** https://discuss.elastic.co/t/lossing-the-rest-documents-when-bulkindexerror-occured/354776
**Category:** Elasticsearch
**Created:** [March 5, 2024, 8:44pm UTC](https://discuss.elastic.co/t/lossing-the-rest-documents-when-bulkindexerror-occured/354776 "2024-03-05T20:44:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Josh19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh19/32/132380_2.png) [@Josh19](https://discuss.elastic.co/u/Josh19)
#### Post date: [March 5, 2024, 8:44pm UTC](https://discuss.elastic.co/t/lossing-the-rest-documents-when-bulkindexerror-occured/354776/1 "2024-03-05T20:44:54Z")

</div>

I wanna know process of the rest documents when BulkIndexError occured.

official document says bulk process is indexing documents by each so there is no problem with rest docs, even if there is some indexerror on some documents.

But I think they are gone away because,  
in my experience,  
1. i got list[1000dicts] and each dict had unique ID.  
2. I tried to bulk that list like below.

```auto
           try:
               helpers.bulk(es_client, documents)
           except elasticsearch.helpers.BulkIndexError as e:
               for error in e.errors:
                   with open(
                       error_file_path, "a",
                       encoding="utf-8",
                   ) as error_file:
                       json.dump(error, error_file, indent=4)

```

.  
3. Finished bulking and there is 1 error log in json file.  
4. But only 599 documents on my index.  
5. I tried to bulk 999 documents except the one what is written on json  
6. finally 999 documents on my index

My experience represent that bulking is not asynchronous right?  
i suspect that bulking is indexing documents one by one synchronously and rest docs are gone if a bulkindexerror occured.

Am i wrong? or anyone knows about this issue

---

<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: [April 2, 2024, 8:45pm UTC](https://discuss.elastic.co/t/lossing-the-rest-documents-when-bulkindexerror-occured/354776/2 "2024-04-02T20:45:27Z")

</div>

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