Shun Miyazawa 2 лет назад
Родитель
Сommit
c416ac35e6
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      apps/app/src/server/service/search-delegator/elasticsearch.ts

+ 5 - 5
apps/app/src/server/service/search-delegator/elasticsearch.ts

@@ -659,16 +659,16 @@ class ElasticsearchDelegator implements SearchDelegator<Data, ESTermsKey, ESQuer
 
     const searchResponse = await this.client.search(query);
 
-    const total = searchResponse?.hits?.total;
-    let totalCount = 0;
-    if (typeof total === 'object') {
-      totalCount = total.value;
+    const _total = searchResponse?.hits?.total;
+    let total = 0;
+    if (typeof _total === 'object') {
+      total = _total.value;
     }
 
     return {
       meta: {
+        total,
         took: searchResponse.took,
-        total: totalCount,
         hitsCount: searchResponse.hits.hits.length,
       },
       data: searchResponse.hits.hits.map((elm) => {