# How to delete data in elastic search through id

**URL:** <https://discuss.elastic.co/t/how-to-delete-data-in-elastic-search-through-id/126421>\
**Category:** Elasticsearch\
**Created:** [April 2, 2018, 11:40am UTC](https://discuss.elastic.co/t/how-to-delete-data-in-elastic-search-through-id/126421 "2018-04-02T11:40:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anil\_Garapati](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Anil\_Garapati](https://discuss.elastic.co/u/Anil_Garapati)\
**Post date:** [April 2, 2018, 11:40am UTC](https://discuss.elastic.co/t/how-to-delete-data-in-elastic-search-through-id/126421/1 "2018-04-02T11:40:16Z")

</div>

def deleteContentByContentId(contentId:String):Boolean={  
eitherTryBlock{  
val search = searchHelper.createContentSearch(client, Nil, List(contentId), 0, 10)  
val response = search.get()  
val result=response.  
}  
}

I waned to delete response variable in scala...can anyone help

---

<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:** [April 30, 2018, 11:41am UTC](https://discuss.elastic.co/t/how-to-delete-data-in-elastic-search-through-id/126421/2 "2018-04-30T11:41:09Z")

</div>

Closed on April 30, 2018, 11:41am UTC

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