How to limit the amount of submitted documents?


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


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

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?

No, only for an index.

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? :slightly_smiling:

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.

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

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

thanks for help anyway