Deleting and immediately recreating a document type leads to error

To clear all indexed items we first delete a document type and recreate it immediately. Unfortunately we get an error on creating the document type:
{ "error": "Invalid record. \nmessage:\n Validation of DocumentType failed.\nsummary:\n The following errors were found: Name is already taken\nresolution:\n Try persisting the document with valid data or remove the validations." }

If we wait some time (i.e. using sleep(3)) everything works fine.

Q: Is there a better solution than using sleep()? The post request is made synchronous.

Hey Stefan,

Thanks for reporting this! I’ve passed it along to our engineering team and we’re currently evaluating solutions.