From e165837a154243305dc300acaa29605732290f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Tue, 6 Oct 2020 14:16:05 +0200 Subject: [PATCH] fix: properly check if an object exists before update Closes #70 --- src/storage/elasticsearch/elasticsearch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/elasticsearch/elasticsearch.ts b/src/storage/elasticsearch/elasticsearch.ts index 0450b9ab..1188b7f2 100644 --- a/src/storage/elasticsearch/elasticsearch.ts +++ b/src/storage/elasticsearch/elasticsearch.ts @@ -234,7 +234,7 @@ export class Elasticsearch implements Database { size: 1, }); - if (searchResponse.body.hits.total > 1) { + if (searchResponse.body.hits.total > 0) { return { exists: true, object: searchResponse.body.hits.hits[0],