elasticsuite
elasticsuite copied to clipboard
Field category_permissions_field does not exists in mapping
Hi, After Magento Upgrade we found that public graphql query for products is failing
HTTP Status Code is 200 but response says "message": "Internal server error".
After digging into the logs we found such an error:
Field category_permissions_field does not exists in mapping
### Preconditions
We just deployed Magento EE Upgrade 2.4.5-p1 to production on Magento Cloud and switched from elasticsearch to Opensearch 1.2
Magento Version : 2.4.5-p1 EE ElasticSuite Version : 2.10.13.3 Environment : Production
Hi @vetalkab
I guess your website relies on the "category permission" feature of Magento ? Some categories are visible only for particular customers, something like that ?
From which version did you upgrade ?
Do you have a more detailed stacktrace from your log file ? I'd like to see from where this error is triggered.
Regards
Hi @romainruaud Yes, our site relies on the "category permission" feature of Magento. Different customer groups have a different level of access to the categories. We upgraded Magento from version 2.4.3-p3 to version 2.4.5-p1
The only error we get in system.log is: `[2023-03-06T19:22:26.388938+00:00] report.ERROR: Field category_permissions_field does not exists in mapping
GraphQL (18:13) 17: name 18: products( ^ 19: pageSize: 10, [] []`
On this project we also use smile/module-elasticsuite-cms-search and smile/module-elasticsuite-quick-order.
We also managed to reproduce the issue on another test server, not on magento.cloud and there is used Elasticsearch Version 1.17
Also Magento Support provided such feedback: We have investigated the issue and we were able to reproduce the issue over your production dumps. Please find the below information from the issue investigation.
Cause of the issue: Smile_ElasticsuiteCore, Smile_ElasticsuiteCatalog, Smile_ElasticsuiteCatalogGraphQl 3rd party modules
After disabling the modules, the issue has been resolved and I was able to get the intended output.
Please verify the root cause by disabling the Smile_ElasticsuiteCore, Smile_ElasticsuiteCatalog, Smile_ElasticsuiteCatalogGraphQ extensions. And contact the Smile_ElasticsuiteCore module developers to get the issue fixed.
Hope this data help in the investigation.
Thank you for the quick response.
Regards, Vitalii
Hello,
I think you might need to add the category_permissions_field
as a filterable field for Elasticsuite, like it's done here for the url_key
:
https://github.com/Smile-SA/elasticsuite/blob/2.10.x/src/module-elasticsuite-catalog-graph-ql/etc/elasticsuite_indices.xml#L24
And then clean the cache and proceed with a full reindex.
Hi @romainruaud Thank you for the suggested solution however this fix doesn't help. In order to fix the issue we had to disable plugin \Magento\ElasticsearchCatalogPermissionsGraphQl\Plugin\CatalogGraphQl\ProductSearchCriteriaFilter disable-catalog-permissions-graphql-incompatible-smile-elasticsuite.patch
We also managed to replicate this issue on another project Magento 2.4.5-p1, with your module and B2B.
Regards, Vitalii
Hi @romainruaud
The reported error disappeared, but the product query results become empty after adding the mapping fields.
I tried adding the mapping field like "category_permissions_field" && "category_permissions_value" after reindexing and cleaning the cache. the product results become empty.
After adding fields as filterable:
Hi @romainruaud, I can confirm that this happens on a clean Magento 2.4.6 with ElasticSuite installed as well. Even with category_permissions_value and category_permissions_field added as filterable the result is empty, because the fields corresponding to catalog permissions that are indexed on clean Magento are no longer indexed with ElasticSuite enabled.
This is what exists in the index on clean Magento:
Those fields consist of the "category_permission_" string followed by a store ID and a customer group ID (\Magento\ElasticsearchCatalogPermissions\Model\Adapter\FieldMapper\Product\FieldProvider\FieldName\Resolver\CategoryPermission for reference).
On ElasticSuite product indexes they're not there, so filtering by them results in an empty set being returned.
I am having exactly the same issue. In our case we are going the other way: We want to start leveraging category permissions and events
Magento 2.4.6-p3 ElasticSuite: 2.11.4.2
Kind of the same problem, but on Open Source, without any additional modules and not in the GraphQL, but while using a filter on the frontend.
Field directly_available does not exists in mapping
Magento ver. 2.4.6-p3 ElasticSuite Open Source ver. 2.11.4.1