Closed
Description
Preconditions (*)
Magento version 2.3.3
Elasticsearch 6.0
Stores->Configuration->Catalog->Catalog->Catalog Search->Search Engine = Elasticsearch 6.0+
Steps to reproduce (*)
NEW steps used for REOPEN on 2.4-develop
-> #25038 (comment)
- Set Elasticsearch 6.0 as search engine
- bin/magento indexer:reindex
- Go to category page that have more than one page
- Navigate to second page
Expected result (*)
Products from the second page are displayed.
Actual result (*)
No products found.
More details
I've digged up in Magento's ES implementation and found really strange thing. Magento is requesting elasticsearch with from
and size
parameters that limits search results but additionally there is another limit in \Magento\Eav\Model\Entity\Collection\AbstractCollection::_loadEntities
$this->getSelect()->limitPage($this->getCurPage(), $this->_pageSize);
Result is as follow for second page of category listing:
- Elasticsearch returns second page of products limited by
from
andsize
and magento is adding product IDs to the collection.
Example ElasticSearch request:
POST /magento2_product_1/document/_search
{
"from":9,
"size":9,
"stored_fields":[
"_id",
"_score"
],
"sort":[
{
"position_category_5":{
"order":"asc"
}
}
],
"query":{
"bool":{
"must":[
{
"term":{
"category_ids":"5"
}
},
{
"terms":{
"visibility":[
"2",
"4"
]
}
}
]
}
},
"aggregations":{
"price_bucket":{
"extended_stats":{
"field":"price_0_1"
}
},
"category_bucket":{
"terms":{
"field":"category_ids",
"size":500
}
},
"manufacturer_bucket":{
"terms":{
"field":"manufacturer",
"size":500
}
},
"color_bucket":{
"terms":{
"field":"color",
"size":500
}
}
}
}
- Collection executes
_loadEntities
and add yet another limit which goes way out of collection
s range and this leads to 0 results found.
Metadata
Metadata
Assignees
Labels
Cannot reproduce the issue on the latest `2.4-develop` branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentOnce P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Affects critical data or functionality and forces users to employ a workaround.