# Remove all documents from engine

**URL:** <https://discuss.elastic.co/t/remove-all-documents-from-engine/286444>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [October 12, 2021, 7:38am UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444 "2021-10-12T07:38:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![artcups](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artcups/32/93899_2.png) [@artcups](https://discuss.elastic.co/u/artcups)\
**Post date:** [October 12, 2021, 7:38am UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/1 "2021-10-12T07:38:26Z")

</div>

Hi

We have an e-commerce and our assortment can change externally from the PIM without us knowing about it therefor we have to remove all documents and then add the current articles again.

My problem is that i cant find any api documentation on how to delete all documents from the engine, is there any?

If not, how should one go about it?

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [October 12, 2021, 12:24pm UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/2 "2021-10-12T12:24:52Z")

</div>

There's no way to delete all documents from an engine in one API request. You'd need to work with the Documents API: [Documents API | Elastic App Search Documentation [7.15] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html).

Just a thought, if you need to regularly delete all documents and recreate them... you might be able to use [Meta Engines](https://www.elastic.co/guide/en/app-search/current/meta-engines-guide.html).

You could create a Meta Engine that is backed by a Source Engine. Load all of your documents into the Source Engine, and whenever you need to delete all documents, delete the Source Engine, recreate it as a new engine, and load all documents.

You'd keep all of your relevance settings in the Meta Engine, etc. so that it is still retained when you drop the underlying Source Engine and recreate it.

Just a thought.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [October 12, 2021, 12:27pm UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/3 "2021-10-12T12:27:04Z")

</div>

Does your PIM support web hooks of some sort? You could set up a hook that executes whenever data changes in your PIM to make an API request to App Search in order to keep your data in sync.

---

<div class="post-metadata">

**Author:** ![sanderunive](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sanderunive](https://discuss.elastic.co/u/sanderunive)\
**Post date:** [October 12, 2021, 1:59pm UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/4 "2021-10-12T13:59:04Z")

</div>

We used this same solution, rebuilding a source engine, after a big update. You need to remember to update your Curations (if you have any) in your Meta Engine because ID's for the documents in the source engine(s) will be changed if you do this.

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [October 13, 2021, 3:44pm UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/5 "2021-10-13T15:44:33Z")

</div>

Good point.

---

<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:** [November 10, 2021, 3:45pm UTC](https://discuss.elastic.co/t/remove-all-documents-from-engine/286444/6 "2021-11-10T15:45:13Z")

</div>

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