# Messages getting lost during insertion

**URL:** <https://discuss.elastic.co/t/messages-getting-lost-during-insertion/5370>\
**Category:** Elasticsearch\
**Created:** [September 13, 2011, 9:50am UTC](https://discuss.elastic.co/t/messages-getting-lost-during-insertion/5370 "2011-09-13T09:50:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spokarna](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@spokarna](https://discuss.elastic.co/u/spokarna)\
**Post date:** [September 13, 2011, 9:50am UTC](https://discuss.elastic.co/t/messages-getting-lost-during-insertion/5370/1 "2011-09-13T09:50:47Z")

</div>

Hi All,  
I am writing messages into elasticsearch using a single thread, and  
using the call:  
transportClient.prepareIndex(index, type, id)  
.setSource(node)  
.execute()  
.actionGet();  
If I write messages continuously, I observe that some messages are  
lost somewhere in transit, and my query returns less entries than I  
write.

If I use elasticsearchhead UI, I see the status of the index as  
test  
size: 68.9mb (68.9mb)  
docs: 42795 (42820)

My index status returns:  
docs: {  
num\_docs: 42795  
max\_doc: 42820  
deleted\_docs: 25  
}

The max\_docs is less than the number of entries that I pushed into  
ElasticSearch. And why are some messages marked as deleted?  
I am using ElasticSearch 0.16.2.

Regards,  
Sameer

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 13, 2011, 10:12am UTC](https://discuss.elastic.co/t/messages-getting-lost-during-insertion/5370/2 "2011-09-13T10:12:12Z")

</div>

Are you sure you don't index the same document several time (same id)? If  
you want to be sure, you can call setOpType(IndexRequest.OpType.CREATE) just  
after setSource, and indexing will fail if there is already an existing doc  
with the same id.

On Tue, Sep 13, 2011 at 12:50 PM, Sameer [sameerpokarna@gmail.com](mailto:sameerpokarna@gmail.com) wrote:

> Hi All,  
> I am writing messages into elasticsearch using a single thread, and  
> using the call:  
> transportClient.prepareIndex(index, type, id)  
> .setSource(node)  
> .execute()  
> .actionGet();  
> If I write messages continuously, I observe that some messages are  
> lost somewhere in transit, and my query returns less entries than I  
> write.
> 
> If I use elasticsearchhead UI, I see the status of the index as  
> test  
> size: 68.9mb (68.9mb)  
> docs: 42795 (42820)
> 
> My index status returns:  
> docs: {  
> num\_docs: 42795  
> max\_doc: 42820  
> deleted\_docs: 25  
> }
> 
> The max\_docs is less than the number of entries that I pushed into  
> Elasticsearch. And why are some messages marked as deleted?  
> I am using Elasticsearch 0.16.2.
> 
> Regards,  
> Sameer

---

<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 6, 2017, 3:54am UTC](https://discuss.elastic.co/t/messages-getting-lost-during-insertion/5370/3 "2017-07-06T03:54:33Z")

</div>


