Browse Source

fix(elasticsearch-plugin): Correctly report facetValue counts

Michael Bromley 6 years ago
parent
commit
2f8af7c804
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/elasticsearch-plugin/src/elasticsearch.service.ts

+ 2 - 2
packages/elasticsearch-plugin/src/elasticsearch.service.ts

@@ -104,8 +104,8 @@ export class ElasticsearchService {
             },
         };
         const { body }: { body: SearchResponseBody<VariantIndexItem> } = await this.client.search({
-            index: indexPrefix + VARIANT_INDEX_NAME,
-            type: VARIANT_INDEX_TYPE,
+            index: indexPrefix + (input.groupByProduct ? PRODUCT_INDEX_NAME : VARIANT_INDEX_NAME),
+            type: input.groupByProduct ? PRODUCT_INDEX_TYPE : VARIANT_INDEX_TYPE,
             body: elasticSearchBody,
         });