# Documents deletion in shards

**URL:** <https://discuss.elastic.co/t/documents-deletion-in-shards/140992>\
**Category:** Elasticsearch\
**Created:** [July 21, 2018, 11:39am UTC](https://discuss.elastic.co/t/documents-deletion-in-shards/140992 "2018-07-21T11:39:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itay\_Bittan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itay_bittan/32/23527_2.png) [@Itay\_Bittan](https://discuss.elastic.co/u/Itay_Bittan)\
**Post date:** [July 21, 2018, 11:39am UTC](https://discuss.elastic.co/t/documents-deletion-in-shards/140992/1 "2018-07-21T11:39:40Z")

</div>

I have initial index with 5,655,272 documents, divided to 4 shards.  
My python module deletes most of the documents and leave ~1.4M (out of 5.6M).  
Then I also run "merge segments" to improve index serving time.  
Now if I run  
`GET /s_8766822_1532083664603/_count`  
I'm getting:  
{  
"count": 1413818,  
"\_shards": {  
"total": 4,  
"successful": 4,  
"failed": 0  
}  
}  
as expected.  
But If I run:  
`GET /s_8766822_1532083664603/_status`  
it looks like the total `num_docs` of all shards are 5,655,272 (the initial size, before deletion). `deleted_docs` is 0 in all shards.

What do I miss here? each shard should have quarter of 1,413,818 no? (put here 2 out of 4 shards output because of text limit):  
{  
"\_shards": {  
"total": 20,  
"successful": 20,  
"failed": 0  
},  
"indices": {  
"s\_8766822\_1532083664603": {  
"index": {  
"primary\_size\_in\_bytes": 2352080843,  
"size\_in\_bytes": 11760404359  
},  
"translog": {  
"operations": 0  
},  
"docs": {  
"num\_docs": 5655272,  
"max\_doc": 5655272,  
"deleted\_docs": 0  
},  
"merges": {  
"current": 0,  
"current\_docs": 0,  
"current\_size\_in\_bytes": 0,  
"total": 0,  
"total\_time\_in\_millis": 0,  
"total\_docs": 0,  
"total\_size\_in\_bytes": 0  
},  
"refresh": {  
"total": 0,  
"total\_time\_in\_millis": 0  
},  
"flush": {  
"total": 0,  
"total\_time\_in\_millis": 0  
},  
"shards": {  
"0": [  
{  
"routing": {  
"state": "STARTED",  
"primary": true,  
"node": "X5-CaxyYT2acVXuaibIarA",  
"relocating\_node": null,  
"shard": 0,  
"index": "s\_8766822\_1532083664603"  
},  
"state": "STARTED",  
"index": {  
"size\_in\_bytes": 590843614  
},  
"translog": {  
"id": 1532083755595,  
"operations": 0  
},  
"docs": {  
"num\_docs": 1414952,  
"max\_doc": 1414952,  
"deleted\_docs": 0  
},  
"merges": {  
"current": 0,  
"current\_docs": 0,  
"current\_size\_in\_bytes": 0,  
"total": 0,  
"total\_time\_in\_millis": 0,  
"total\_docs": 0,  
"total\_size\_in\_bytes": 0  
},  
"refresh": {  
"total": 0,  
"total\_time\_in\_millis": 0  
},  
"flush": {  
"total": 0,  
"total\_time\_in\_millis": 0  
}  
}  
],  
"1": [  
{  
"routing": {  
"state": "STARTED",  
"primary": false,  
"node": "l2Rtnz1gQJeWF5A\_9OHKBA",  
"relocating\_node": null,  
"shard": 1,  
"index": "s\_8766822\_1532083664603"  
},  
"state": "STARTED",  
"index": {  
"size\_in\_bytes": 588198936  
},  
"translog": {  
"id": 1532083755554,  
"operations": 0  
},  
"docs": {  
"num\_docs": 1413552,  
"max\_doc": 1413552,  
"deleted\_docs": 0  
},  
"merges": {  
"current": 0,  
"current\_docs": 0,  
"current\_size\_in\_bytes": 0,  
"total": 0,  
"total\_time\_in\_millis": 0,  
"total\_docs": 0,  
"total\_size\_in\_bytes": 0  
},  
"refresh": {  
"total": 0,  
"total\_time\_in\_millis": 0  
},  
"flush": {  
"total": 0,  
"total\_time\_in\_millis": 0  
}  
}  
]  
}  
}  
}  
}

---

<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:** [August 18, 2018, 11:39am UTC](https://discuss.elastic.co/t/documents-deletion-in-shards/140992/2 "2018-08-18T11:39:42Z")

</div>

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