# Bulk inserts more documents than given

**URL:** https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280
**Category:** Elasticsearch
**Created:** [September 4, 2023, 4:24pm UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280 "2023-09-04T16:24:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Kostyantyn\_Dobriohlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kostyantyn_dobriohlo/32/104458_2.png) [@Kostyantyn\_Dobriohlo](https://discuss.elastic.co/u/Kostyantyn_Dobriohlo)
#### Post date: [September 4, 2023, 4:24pm UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280/1 "2023-09-04T16:24:36Z")

</div>

Elasticsearched configured in single-node mode, I have ~1 million elements, but after bulk insert operation I see 10 million elements. I use this python code:

```auto
def generate_docs(data):
    for item in data:
        doc = {
            '_index': 'my_index',
            '_source': item
        }

bulk(client, generate_docs)

```

What a reason of this duplication and is it a real problem?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [September 4, 2023, 7:10pm UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280/2 "2023-09-04T19:10:58Z")

</div>

Where do you see 10m?

Are you using nested field type in your mapping?

---

<div class="post-metadata">

### Author: ![Kostyantyn\_Dobriohlo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kostyantyn_dobriohlo/32/104458_2.png) [@Kostyantyn\_Dobriohlo](https://discuss.elastic.co/u/Kostyantyn_Dobriohlo)
#### Post date: [September 5, 2023, 6:06am UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280/3 "2023-09-05T06:06:10Z")

</div>

I see it when call \_cat/indices. And yes, I use nested field type

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [September 5, 2023, 6:30am UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280/4 "2023-09-05T06:30:29Z")

</div>

So that's expected.

A nested document is a Lucene document. Which you see in the cat API.  
If you run a search, you should get the right number.

---

<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: [October 3, 2023, 6:31am UTC](https://discuss.elastic.co/t/bulk-inserts-more-documents-than-given/342280/5 "2023-10-03T06:31:18Z")

</div>

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