# ES 2.3.2 Delete by Query increasing "Size" parameter is not helping

**URL:** <https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669>\
**Category:** Elasticsearch\
**Created:** [December 12, 2016, 7:50am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669 "2016-12-12T07:50:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 12, 2016, 7:50am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/1 "2016-12-12T07:50:21Z")

</div>

Hi,

I am executing the the delete by query plugin as below. The index is having around 600000 documents and the type which i want to delete is having 105365 documents. Irrespective of the value of size i set, the total time to delete the document is same. Is there a way to increase the delete speed relatively?

curl -XDELETE "[http://poc10uas.us.com:9200/defaultindex/portalregistry/\_query?source={""query"":{""match\_all"":{}](http://poc10uas.us.com:9200/defaultindex/portalregistry/_query?source=%7B%22%22query%22%22:%7B%22%22match_all%22%22:%7B%7D)}}&size=10000"

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 12, 2016, 11:28am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/2 "2016-12-12T11:28:01Z")

</div>

@nik9000 @dadoonet plz advice

---

<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:** [December 12, 2016, 12:25pm UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/3 "2016-12-12T12:25:15Z")

</div>

Please read carefully the end of: [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21/1)

---

<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:** [December 17, 2016, 11:47am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/4 "2016-12-17T11:47:43Z")

</div>

Changing size won't help here.

You can try another strategy which is to reindex in another index using reindex API and see if it is worth it.

Deleting a lot of docs is per nature slow.

Is it a recurring operation? Or one time?

May be you can look at daily indices depending on your case?

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 19, 2016, 7:17am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/5 "2016-12-19T07:17:19Z")

</div>

Hi,

Its a recurring operation and indices are not time based to segregate them to indices based on time.  
Could you please let me know what the functionality of size parameter? It is similar to scroll\_size param in ES 5.0 delete by query api?

---

<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:** [December 19, 2016, 7:42am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/6 "2016-12-19T07:42:12Z")

</div>

May be you are using a 2.x version, here? I'm surprised that `size` is accepted.

In 5.1, you can do Delete by query operations in parallel using `slice`:

[https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-delete-by-query.html#docs-delete-by-query-automatic-slice](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/docs-delete-by-query.html#docs-delete-by-query-automatic-slice)

So you'll be able to do that in less time I think than in 2.x series.  
But with more load on the cluster.

Note that deleting a lot of data has an impact on IOs. Your cluster will probably do a lot of merge operations.

Wondering what will be actually your query? A `match_all`?

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 19, 2016, 8:11am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/7 "2016-12-19T08:11:06Z")

</div>

> [@dadoonet](#):
>
> May be you are using a 2.x version, here? I'm surprised that size is accepted.

Yes . Documentation which mentions about size ([Using Delete-by-Query | Elasticsearch Plugins and Integrations [2.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/plugins/2.0/delete-by-query-usage.html))

> [@dadoonet](#):
>
> Wondering what will be actually your query? A match\_all?

Yes query is a match\_all. curl -XDELETE "[http://poc10uas.us.com:9200/defaultindex/portalregistry/\_query?source={""query"":{""match\_all"":{}](http://poc10uas.us.com:9200/defaultindex/portalregistry/_query?source=%7B%22%22query%22%22:%7B%22%22match_all%22%22:%7B%7D)}}&size=10000"

---

<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:** [December 19, 2016, 8:37am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/8 "2016-12-19T08:37:04Z")

</div>

So it's definitely better to have one index per type. And simply drop the index.

So instead of sending your docs in `defaultindex/portalregistry`, send them in `defaultindex-portalregistry/portalregistry`.

When needed, just run `DELETE defaultindex-portalregistry` and it will be immediate!

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 19, 2016, 8:54am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/9 "2016-12-19T08:54:02Z")

</div>

> [@dadoonet](#):
>
> So it's definitely better to have one index per type. And simply drop the index.

We have one index with multiple types under it. Each types has roughly the same number of documents baring a few. Typically we have 1 index with around 30 types.

Each type has roughly 40000 - 60000

Say if i want to move each type to a new index and even though i set the shards to 1or 2(primary), wont it affect the overall system performance as there are too many shards and each will have its own contention for resources. Would it be a good design considering we have a single 3 ES servers with 16 GB ES\_HEAP\_SIZE and multi core cpu's.

---

<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:** [December 19, 2016, 9:45am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/10 "2016-12-19T09:45:31Z")

</div>

I'd create one index per type with one single shard. So you will end up to 60 shards (including 1 replica) on 3 nodes, which is around 20 shards per node. It looks reasonable to me.

Note that we have been discussing for a while the possibility of removing types.

> <https://github.com/elastic/elasticsearch/issues/15613>

So with the one-type-per-index strategy, you will be ready for that 🙂

---

<div class="post-metadata">

**Author:** ![SKumarMN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skumarmn/32/27537_2.png) [@SKumarMN](https://discuss.elastic.co/u/SKumarMN)\
**Post date:** [December 20, 2016, 10:50am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/11 "2016-12-20T10:50:30Z")

</div>

Nice. Thanks for the info.

---

<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:** [January 17, 2017, 10:50am UTC](https://discuss.elastic.co/t/es-2-3-2-delete-by-query-increasing-size-parameter-is-not-helping/68669/12 "2017-01-17T10:50:48Z")

</div>

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