Remove all documents from engine

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?

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.

Just a thought, if you need to regularly delete all documents and recreate them... you might be able to use Meta Engines.

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.

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.

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.

Good point.