elasticsuite icon indicating copy to clipboard operation
elasticsuite copied to clipboard

Field category_permissions_field does not exists in mapping

Open vetalkab opened this issue 1 year ago • 8 comments

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

vetalkab avatar Mar 06 '23 19:03 vetalkab

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

romainruaud avatar Mar 07 '23 09:03 romainruaud

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. magento-support 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

vetalkab avatar Mar 07 '23 10:03 vetalkab

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.

romainruaud avatar Mar 07 '23 10:03 romainruaud

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

vetalkab avatar Mar 07 '23 18:03 vetalkab

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.

image

After adding fields as filterable: image

karthik147 avatar Jun 13 '23 07:06 karthik147

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: image 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.

bgorski avatar Jul 02 '23 14:07 bgorski

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

barbazul avatar Dec 15 '23 19:12 barbazul

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

edwinbos avatar Jan 17 '24 13:01 edwinbos