# Deleting by \_id vs deleting by term performance issue

**URL:** <https://discuss.elastic.co/t/deleting-by--id-vs-deleting-by-term-performance-issue/19956>\
**Category:** Elasticsearch\
**Created:** [September 25, 2014, 8:29am UTC](https://discuss.elastic.co/t/deleting-by--id-vs-deleting-by-term-performance-issue/19956 "2014-09-25T08:29:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![turcanciprianalexand](https://avatars.discourse-cdn.com/v4/letter/t/8e7dd6/32.png) [@turcanciprianalexand](https://discuss.elastic.co/u/turcanciprianalexand)\
**Post date:** [September 25, 2014, 8:29am UTC](https://discuss.elastic.co/t/deleting-by--id-vs-deleting-by-term-performance-issue/19956/1 "2014-09-25T08:29:37Z")

</div>

Hi,

I have an performance issue regarding deleting from elasticsearch. I  
have 2 cases for deletion : 1. delete by term and 2. delete by \_id. The  
delete field is unique.

_1. DELETE by term_. The field I want to delete by term is mapped below :

.startObject(ListenerColumns.SUID.getColumnName())  
.field("type", "string")  
.field("index", "not\_analyzed")  
.field("store", false)  
.endObject()

```
Deleting query : 
        DeleteByQueryRequestBuilder prepareDelete = 

```

client.prepareDeleteByQuery(index);  
prepareDelete.setTypes(table);  
prepareDelete.setQuery(  
termQuery(ListenerColumns.SUID.getColumnName(),  
suidValue)  
);

The upper deleting is taking some time comparing with the next situation  
:

- 
  1. DELETE by \_id\*. The Suid is saved in \*\_id \*field.

My question is how should I configure the elasticsearch mapping for  
getting the same performance, in delete by term - _first case_, like in  
delete by \_id case - _second case_?

Thank you,  
Ciprian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6d5e69aa-de37-4d1a-8b7d-d5af2e143d7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6d5e69aa-de37-4d1a-8b7d-d5af2e143d7f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:00am UTC](https://discuss.elastic.co/t/deleting-by--id-vs-deleting-by-term-performance-issue/19956/2 "2017-07-06T01:00:06Z")

</div>

Closed on July 6, 2017, 1:00am UTC


