From ced6cc0e23832724a4b40019fcef2f5a1d867810 Mon Sep 17 00:00:00 2001 From: mpostma Date: Mon, 22 Jun 2020 15:16:18 +0200 Subject: [PATCH] fix bad error report when primary key exists --- meilisearch-http/src/routes/index.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index ba42dcc5d..a46e70621 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -253,17 +253,8 @@ async fn update_index( if let Some(id) = body.primary_key.clone() { if let Some(mut schema) = index.main.schema(writer)? { - match schema.primary_key() { - Some(_) => { - return Err(Error::bad_request( - "The primary key cannot be updated", - ).into()); - } - None => { - schema.set_primary_key(&id)?; - index.main.put_schema(writer, &schema)?; - } - } + schema.set_primary_key(&id)?; + index.main.put_schema(writer, &schema)?; } } index.main.put_updated_at(writer)?;