magento2: Multivalued filters don't work correctly with ElasticSearch
Preconditions
- Install Magento 2.2.6 and ES 5.x
- Create a multiselect filterable attribute and assign 3 values to it : “A”, “B”, “C”
- Create a category, an enabled product and select “A” and “C” values for the previous attribute. Put the product in the category.
- Configure ES as search engine
- Reindex all
Steps to reproduce
- Go to the category page, the product should be displayed
Expected result
- In the filter block the attribute should appear with the options “A” and “C” (the only values with non-null result after filtering)
Actual result
- The filter won’t appear.
The cause seems to be because the attribute is registered in ES with the keyword
analyzer which creates a single term with the attribute’s option IDs (let’s say “23 24
”) and the search request is sent with the term
query which searches for an exact match for each option ID (let’s say “23
” or “24
”, which obviously won’t match here).
Of course, switching to MySQL search engine instead of ES solves the issue.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (15 by maintainers)
Preconditions
Magento 2.3-develop commit d7012b2ca1495676478d8afed8bf016ccd03bc8a
Steps to reproduce
Expected result
In the filter block the attribute should appear with the options “A” and “C” (the only values with non-null result after filtering)
Actual result
There has been an error processing your request Exception printing is disabled by default for security reasons.
Error log record number: XXXXXXXXXXXX
Exception log:
I was not able to reproduce the issue on latest 2.2-develop and latest available ElasticSearch 5+, because ElasticSearch was not in the list of available search providers.
Additional information:
@xi-ao, please specify your version of ElasticSearch. I check the version by executing this request:
Hi @sdzhepa , Indeed im unable to reproduce the error. The bug seems to be absent from current
2.3-develop
. Tested on elasticsearch 5.6.1 with magento backend optionelasticsearch 5.0+
Also tested on elasticsearch 6.X, with magento option
elasticsearch 6.0+
no issues there as well.Side note: I encountered the error on 2.3.0 with elasticsearch 5.0. (see @TomashKhamlai steps to reproduce the bug )
Regards.
I’ll help with the documentation updates.
@TomashKhamlai Thank you for verifying the issue. Based on the provided information internal tickets
MAGETWO-96261
were created