Issue with Product Display after installing Vendure ElasticSearchPlugin
Hi @gioboa, On Verndure v2.1.9 or v2.2.0 server side, I disable defaultSearchPlugin, then configure ElasticSearchPlugin with basic config options as:
ElasticsearchPlugin.init({
host: 'http://localhost',
port: 9200,
bufferUpdates: false,
}),
then re-index the products, and it's displaying only 10 products from either root or child collections, instead of showing the total list of products present in a collection on the storefront.
GQL query:
query GetProductsInCollections {
collections {
items {
name
slug
parent {
name
}
productVariants {
totalItems
}
}
}
}
The result is:
{
"data": {
"collections": {
"items": [
{
"name": "Electronics",
"slug": "electronics",
"parent": {
"name": "__root_collection__"
},
"productVariants": {
"totalItems": 34
}
},
{
"name": "Computers",
"slug": "computers",
"parent": {
"name": "Electronics"
},
"productVariants": {
"totalItems": 25
}
},
{
"name": "Furniture",
"slug": "furniture",
"parent": {
"name": "Home & Garden"
},
"productVariants": {
"totalItems": 13
}
},
{
"name": "Equipment",
"slug": "equipment",
"parent": {
"name": "Sports & Outdoor"
},
"productVariants": {
"totalItems": 8
}
},
{
"name": "Camera & Photo",
"slug": "camera-photo",
"parent": {
"name": "Electronics"
},
"productVariants": {
"totalItems": 9
}
},
{
"name": "Home & Garden",
"slug": "home-garden",
"parent": {
"name": "__root_collection__"
},
"productVariants": {
"totalItems": 22
}
},
{
"name": "Plants",
"slug": "plants",
"parent": {
"name": "Home & Garden"
},
"productVariants": {
"totalItems": 9
}
},
{
"name": "Footwear",
"slug": "footwear",
"parent": {
"name": "Sports & Outdoor"
},
"productVariants": {
"totalItems": 24
}
},
{
"name": "Sports & Outdoor",
"slug": "sports-outdoor",
"parent": {
"name": "__root_collection__"
},
"productVariants": {
"totalItems": 32
}
}
]
}
}
}
Both server and storefront are fresh installed
Hi @gioboa,
I've cross-verified with the Remix storefront. With the same setup, all products in a collection are displaying in Remix, but not in Qwik storefront. Thanks for your assistance in advance.
Vendure features are a bit out of my knowledge. I tag @michaelbromley, for sure he will have a good answer
Hi @ashishkpaul I think this may be because the Elasticsearch plugin defaults to take: 10 if no explicit take argument is passed to the search query:
https://github.com/vendure-ecommerce/vendure/blob/0441a0338aeb7742012e24594feb67935d09b2fc/packages/elasticsearch-plugin/src/build-elastic-body.ts#L136
Basically, in qwik storefront, needs to add pagination logic