From bda74728807d8d8e6e3d75b1b201e6e0e9deb8ec Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 12 Oct 2021 15:31:59 +0200 Subject: [PATCH] log the documetns updated route --- .../src/routes/indexes/documents.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/meilisearch-http/src/routes/indexes/documents.rs b/meilisearch-http/src/routes/indexes/documents.rs index e5eb15fbf..1e8a803dc 100644 --- a/meilisearch-http/src/routes/indexes/documents.rs +++ b/meilisearch-http/src/routes/indexes/documents.rs @@ -167,12 +167,25 @@ pub async fn update_documents( params: web::Query, body: Payload, req: HttpRequest, + analytics: web::Data<&'static dyn Analytics>, ) -> Result { debug!("called with params: {:?}", params); + let content_type = req + .headers() + .get("Content-type") + .map(|s| s.to_str().unwrap_or("unkown")); + + analytics.publish( + "Documents Updated".to_string(), + json!({ + "payload_type": content_type, + "with_primary_key": params.primary_key, + "index_creation": meilisearch.get_index(path.index_uid.clone()).await.is_ok(), + }), + ); + document_addition( - req.headers() - .get("Content-type") - .map(|s| s.to_str().unwrap_or("unkown")), + content_type, meilisearch, path.into_inner().index_uid, params.into_inner().primary_key,