# Rapidly create, query and delete or purge on 100s of small indices

**URL:** https://discuss.elastic.co/t/rapidly-create-query-and-delete-or-purge-on-100s-of-small-indices/107384
**Category:** Elasticsearch
**Created:** [November 13, 2017, 12:07pm UTC](https://discuss.elastic.co/t/rapidly-create-query-and-delete-or-purge-on-100s-of-small-indices/107384 "2017-11-13T12:07:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shoaib\_javed](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@shoaib\_javed](https://discuss.elastic.co/u/shoaib_javed)
#### Post date: [November 13, 2017, 12:07pm UTC](https://discuss.elastic.co/t/rapidly-create-query-and-delete-or-purge-on-100s-of-small-indices/107384/1 "2017-11-13T12:07:17Z")

</div>

Hi

My usecase requires me to index small volumes of varied data (less than 500 documents with about 20 fields) as separate indices, query on them and immediately destroy them or delete the data in them.

Following steps occurring back-to-back  
Step 1: (One-Time setup or Everytime is OK) Create an index/mapping with dynamic set of 10-30 fields.  
Step 2: Index a few 100 documents OR less  
Step 3: Do some ad hoc querying and aggregations after an on demand refresh  
Step 4 (Optional): Destroy the Index for recreation later or delete the data  
All of this in a matter of a minute or two.

My question is that I need to do this whole 4 steps for 100s of index/mappings (dynamically) over a day with atleast 10 of them happening in parallel at any time - What factors should I consider on sharding, resource allocation and index creation.

Any inputs you can provide is truly appreciated.

---

<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: [November 13, 2017, 12:12pm UTC](https://discuss.elastic.co/t/rapidly-create-query-and-delete-or-purge-on-100s-of-small-indices/107384/2 "2017-11-13T12:12:05Z")

</div>

Every time you create or delete an index or simply alter the mappings, the cluster state will need to be updated and propagated across the cluster. In order to ensure consistency, this is generally done in a single thread, which may very well end up becoming the bottleneck. It is an unusual way to work with Elasticsearch, so I would recommend you testing/benchmarking it.

---

<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: [December 11, 2017, 12:14pm UTC](https://discuss.elastic.co/t/rapidly-create-query-and-delete-or-purge-on-100s-of-small-indices/107384/3 "2017-12-11T12:14:26Z")

</div>

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