diff --git a/packages/elasticsearch-plugin/src/elasticsearch.service.ts b/packages/elasticsearch-plugin/src/elasticsearch.service.ts index 76d3decd4c..c4c5545682 100644 --- a/packages/elasticsearch-plugin/src/elasticsearch.service.ts +++ b/packages/elasticsearch-plugin/src/elasticsearch.service.ts @@ -104,8 +104,8 @@ export class ElasticsearchService { }, }; const { body }: { body: SearchResponseBody } = 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, });