diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index 25fd3f17f..d3f30711c 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -311,9 +311,11 @@ async fn delete_index( data: web::Data, path: web::Path, ) -> Result { - data.db.delete_index(&path.index_uid)?; - - Ok(HttpResponse::NoContent().finish()) + if data.db.delete_index(&path.index_uid)? { + Ok(HttpResponse::NoContent().finish()) + } else { + Err(Error::index_not_found(&path.index_uid).into()) + } } #[derive(Deserialize)]