Closed vetalkab closed 4 years ago
Hi,
that's a strange issue since I don't remember seeing it already on any Magento Cloud hosting.
The solution you proposed might be the most appropriate.
Did you manage to get this setting added by the Magento cloud team ?
Regards
Hi @romainruaud , Yes, Magento Cloud team changed the configuration to: script.allowed_types: inline script.allowed_contexts: search,update,aggs
And this resolved the issue.
good !
we have the same issues on our (cloud) projects as well, is there a way to get code patch to fix that problem or is the script.allowed the only way?
Products are not displayed on Edit Category page in the Admin. Instead of products, it shows a message: 'Your product selection is empty for the selected Store View. If you are running a multi-store setup, please check this manual page for more informations.'. Products are assigned to categories and are displayed on the frontend. Full indexer reindex doesn't help. The issue is reproducible only on Magento Cloud servers and is not reproducible on the local environment.
Preconditions
Magento Cloud, Staging server and Production servers. Magento Enterprise 2.3.4 PHP 7.3
Elastic settings: elasticsearch: type: elasticsearch:6.5 disk: 4096 configuration: plugins:
smile/elasticsuite: the latest version of 2.8
We see in logs request:
{"method":"POST","uri":"http://127.0.0.1:30002/magento2_default_catalog_product/product/_search","headers":{"Host":["127.0.0.1:30002"],"Content-Type":["application/json"],"Accept":["application/json"],"User-Agent":["elasticsearch-php/6.7.1 (Linux 4.15.0-91-generic, PHP 7.2.29)"]},"HTTP code":400,"duration":0.824289,"error":"{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_default_catalog_product_20200406_133957\",\"node\":\"FUTwWME\",\"reason\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}}],\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}}},\"status\":400}"}
And response:
["{\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_default_catalog_product_20200406_133957\",\"node\":\"FUTwWME\",\"reason\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}}],\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"cannot execute [inline] scripts\"}}},\"status\":400}"]
If we change the file
Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Request\Aggregation\Builder\Term
and remove
$aggregation['aggregations']['termRelevance'] = ['avg' => ['script' => $bucket::SORT_ORDER_RELEVANCE]];
and leave only
$aggregation['terms']['order'] = [$bucket::SORT_ORDER_TERM => SortOrderInterface::SORT_ASC];
so we skip aggregation, products appear on Edit Category page.
We think it could be an issue with the elasticsearch configurations like these: script.allowed_types: inline script.allowed_contexts: search,update,aggs