# Delete document from enterprise search

**URL:** <https://discuss.elastic.co/t/delete-document-from-enterprise-search/308637>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [July 1, 2022, 8:16am UTC](https://discuss.elastic.co/t/delete-document-from-enterprise-search/308637 "2022-07-01T08:16:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaralErdene\_Tumursuh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maralerdene_tumursuh/32/73137_2.png) [@MaralErdene\_Tumursuh](https://discuss.elastic.co/u/MaralErdene_Tumursuh)\
**Post date:** [July 1, 2022, 8:16am UTC](https://discuss.elastic.co/t/delete-document-from-enterprise-search/308637/1 "2022-07-01T08:16:42Z")

</div>

Hello Dear,

I'm implementing elastic enterprise search with express.js. So my task is deleting documents from app search. Firstly i used destroyDocuments. But parameter of this function is only document id. So my question is, is it possible that delete by custom field?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Sander\_Philipse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sander_philipse/32/101890_2.png) [@Sander\_Philipse](https://discuss.elastic.co/u/Sander_Philipse)\
**Post date:** [July 4, 2022, 9:13am UTC](https://discuss.elastic.co/t/delete-document-from-enterprise-search/308637/2 "2022-07-04T09:13:19Z")

</div>

Hi @MaralErdene_Tumursuh,

There's no way to add a query to that function, so you'll need to query the documents to be deleted via one of the other functions (depending on your use case) and then pass the resulting document ids to the destroyDocuments function.

---

<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:** [August 1, 2022, 9:13am UTC](https://discuss.elastic.co/t/delete-document-from-enterprise-search/308637/3 "2022-08-01T09:13:31Z")

</div>

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