# How to limit the amount of submitted documents?

**URL:** <https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325>\
**Category:** Elasticsearch\
**Created:** [February 9, 2016, 10:37pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325 "2016-02-09T22:37:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![brand0m](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@brand0m](https://discuss.elastic.co/u/brand0m)\
**Post date:** [February 9, 2016, 10:37pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/1 "2016-02-09T22:37:27Z")

</div>

hello,

in my project I have (index and type): test\_index/rare\_events structure.  
those rare\_events are submitted to ES very rarely and generally I would  
like to store for instance only last 10 of them. how to limit in ES the amount  
of documents during mapping creation for rare\_events type? what is the  
correct approach? thanks in advance for all hints

--  
brand0m

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 9, 2016, 10:43pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/2 "2016-02-09T22:43:43Z")

</div>

The only approach is for you to handle that, there is no way for ES to do it.

---

<div class="post-metadata">

**Author:** ![brand0m](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@brand0m](https://discuss.elastic.co/u/brand0m)\
**Post date:** [February 9, 2016, 10:47pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/3 "2016-02-09T22:47:45Z")

</div>

ok, I see. what about blocking write operations for rare\_events type? is it possible in ES to set a kind of "read only" mode for particular type?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 9, 2016, 10:48pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/4 "2016-02-09T22:48:09Z")

</div>

No, only for an index.

---

<div class="post-metadata">

**Author:** ![brand0m](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@brand0m](https://discuss.elastic.co/u/brand0m)\
**Post date:** [February 9, 2016, 10:51pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/5 "2016-02-09T22:51:13Z")

</div>

ok, I see. would it be reasonable to request such features?

1. set limit for documents per type
2. allow to switch between rw/ro modes for particular types  
what do you think? 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 9, 2016, 10:52pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/6 "2016-02-09T22:52:38Z")

</div>

1, maybe but only for an index.  
2, no. Chances are types will be removed at some point in the future, there are some large changes to them in 2.X that prevent mixing different types in a single index.

---

<div class="post-metadata">

**Author:** ![brand0m](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@brand0m](https://discuss.elastic.co/u/brand0m)\
**Post date:** [February 9, 2016, 10:56pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/7 "2016-02-09T22:56:20Z")

</div>

hmmm... what about handling those two cases by some scripts on ES side? this should be possible (I hope)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 9, 2016, 11:03pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/8 "2016-02-09T23:03:02Z")

</div>

Maybe, but I can't help with that sorry, it's not my area.

---

<div class="post-metadata">

**Author:** ![brand0m](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@brand0m](https://discuss.elastic.co/u/brand0m)\
**Post date:** [February 9, 2016, 11:08pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/9 "2016-02-09T23:08:55Z")

</div>

thanks for help anyway

---

<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, 2017, 11:17pm UTC](https://discuss.elastic.co/t/how-to-limit-the-amount-of-submitted-documents/41325/10 "2017-07-05T23:17:48Z")

</div>


