# Delete few documents out of many before inserting with single index

**URL:** https://discuss.elastic.co/t/delete-few-documents-out-of-many-before-inserting-with-single-index/70755
**Category:** Elasticsearch
**Created:** [January 6, 2017, 7:11am UTC](https://discuss.elastic.co/t/delete-few-documents-out-of-many-before-inserting-with-single-index/70755 "2017-01-06T07:11:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Shishir](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Shishir](https://discuss.elastic.co/u/Shishir)
#### Post date: [January 6, 2017, 7:11am UTC](https://discuss.elastic.co/t/delete-few-documents-out-of-many-before-inserting-with-single-index/70755/1 "2017-01-06T07:11:26Z")

</div>

Hi,

We have a single index, single type set up. Documents are identified based on id and some fields.  
Ex:  
index: geo  
type: geographies

documents =\>

\_id: "provider-1-555"  
\_source: {  
zip: "555",  
"provider": "provider-1",  
"regions": [list of regions]  
}

\_id: "provider-2-444"  
\_source: {  
zip: "444",  
"provider": "provider-2",  
"regions": [list of regions]  
}

We get couple of feeds from different providers which we are inserting to ElasticSearch. What we want is to delete all the existing documents before inserting new data for a single provider without down time.  
I think alias works well in such cases but not sure if it can be used or how to use it in single index setup like ours.

How we can achieve this with current setup?

Thanks.

---

<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: [January 7, 2017, 10:16am UTC](https://discuss.elastic.co/t/delete-few-documents-out-of-many-before-inserting-with-single-index/70755/2 "2017-01-07T10:16:30Z")

</div>

> [@Shishir](#):
>
> What we want is to delete all the existing documents before inserting new data for a single provider without down time.

I'd use aliases with multiple indices, otherwise it's a bit of a pain to do what you want with DBQ/

---

<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: [February 4, 2017, 10:16am UTC](https://discuss.elastic.co/t/delete-few-documents-out-of-many-before-inserting-with-single-index/70755/3 "2017-02-04T10:16:40Z")

</div>

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