# Which is more efficient deleting an Index, or chunk wise bulk delete of docs

**URL:** https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920
**Category:** Elasticsearch
**Created:** [June 7, 2018, 7:51am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920 "2018-06-07T07:51:16Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)
#### Post date: [June 7, 2018, 7:51am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/1 "2018-06-07T07:51:16Z")

</div>

ES (1.7.5)

From a GC, memeory point of view which is more efficient? I have multiple Indices in an ES cluster one of which has 19,809,064 documents. the cluster has 8 data nodes, and 3 masters. One shard per node per index. There is an Index with jsut 2,00,000 documents. What is more efficient from heap usage is deleting the entire index or bulk deleting ~10000 documents at a time ?

From docs it seems that deleting an Index is more efficient as an entire segment is dropped, verses deleting a document and segment merging. Is the same stucture followed in memory ?

How does ES store the documents in memory ?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [June 7, 2018, 8:02am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/2 "2018-06-07T08:02:57Z")

</div>

> [@vmandke](#):
>
> From docs it seems that deleting an Index is more efficient as an entire segment is dropped, verses deleting a document and segment merging. Is the same stucture followed in memory ?

Deleting a full index is as you say much more efficient that bulk deleting individual documents. Documents are however not kept in memory so I am not sure I understand your last question.

---

<div class="post-metadata">

### Author: ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)
#### Post date: [June 7, 2018, 8:04am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/3 "2018-06-07T08:04:46Z")

</div>

In memory, as in I meant are the documents cached for search queries ?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [June 7, 2018, 8:07am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/4 "2018-06-07T08:07:25Z")

</div>

Index structures are cached in memory, not individual documents. Most of this is done at the shard/segment level and is therefore efficiently removed when an index is deleted.

---

<div class="post-metadata">

### Author: ![vmandke](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vmandke](https://discuss.elastic.co/u/vmandke)
#### Post date: [June 7, 2018, 8:11am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/5 "2018-06-07T08:11:38Z")

</div>

Ohhk thanks! This helps a lot. Can you please point me to the docs regarding the internal structure / caching, so I can read more about it ?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [June 7, 2018, 8:16am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/6 "2018-06-07T08:16:29Z")

</div>

I do not think the documentation goes into great depths, but have a look at:

[https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-cache.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-cache.html)

[https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-shard-query-cache.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index-modules-shard-query-cache.html)

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [June 7, 2018, 8:17am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/7 "2018-06-07T08:17:50Z")

</div>

Elasticsearch 1.7.5 is now very old, so I would also recommend that you upgrade... 🙂

---

<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 5, 2018, 8:17am UTC](https://discuss.elastic.co/t/which-is-more-efficient-deleting-an-index-or-chunk-wise-bulk-delete-of-docs/134920/8 "2018-07-05T08:17:52Z")

</div>

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