# Index Trimming

**URL:** <https://discuss.elastic.co/t/index-trimming/9119>\
**Category:** Elasticsearch\
**Created:** [September 24, 2012, 3:11pm UTC](https://discuss.elastic.co/t/index-trimming/9119 "2012-09-24T15:11:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![orenmazor](https://avatars.discourse-cdn.com/v4/letter/o/b782af/32.png) [@orenmazor](https://discuss.elastic.co/u/orenmazor)\
**Post date:** [September 24, 2012, 3:11pm UTC](https://discuss.elastic.co/t/index-trimming/9119/1 "2012-09-24T15:11:39Z")

</div>

hey all,

given a cluster of around 200m large-ish uniform documents, how would you  
go about trimming the index based on a certain mapping property?

right now I run a scroll query on my cluster, and for all the matching  
documents\*, I issue a delete command\*\*. this can be a fairly lengthy  
process. are there any better/faster mechanisms? this is on ES 19.2, by the  
way.

\*I check a date property. I used to use TTL to trim these out, but that  
stopped working after the 19.2 update. we'll be updating to 19.9 in the  
next few weeks, but this trim would help shrink the index in the short term.  
\*\*it's actually a routed bulk delete of 500-1000 documents.

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [September 24, 2012, 3:51pm UTC](https://discuss.elastic.co/t/index-trimming/9119/2 "2012-09-24T15:51:14Z")

</div>

Hi Oren

> given a cluster of around 200m large-ish uniform documents, how would  
> you go about trimming the index based on a certain mapping property?
> 
> right now I run a scroll query on my cluster, and for all the matching  
> documents\*, I issue a delete command\*\*. this can be a fairly lengthy  
> process. are there any better/faster mechanisms? this is on ES 19.2,  
> by the way.

Have you tried delete-by-query ?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

clint

--

---

<div class="post-metadata">

**Author:** ![orenmazor](https://avatars.discourse-cdn.com/v4/letter/o/b782af/32.png) [@orenmazor](https://discuss.elastic.co/u/orenmazor)\
**Post date:** [September 24, 2012, 8:58pm UTC](https://discuss.elastic.co/t/index-trimming/9119/3 "2012-09-24T20:58:52Z")

</div>

awesome. that's exactly what I needed.

On Monday, September 24, 2012 11:51:29 AM UTC-4, Clinton Gormley wrote:

> Hi Oren
> 
> > given a cluster of around 200m large-ish uniform documents, how would  
> > you go about trimming the index based on a certain mapping property?
> > 
> > right now I run a scroll query on my cluster, and for all the matching  
> > documents\*, I issue a delete command\*\*. this can be a fairly lengthy  
> > process. are there any better/faster mechanisms? this is on ES 19.2,  
> > by the way.
> 
> Have you tried delete-by-query ?
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/delete-by-query.html)
> 
> clint

--

---

<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:11am UTC](https://discuss.elastic.co/t/index-trimming/9119/4 "2017-07-06T03:11:38Z")

</div>


