elasticsuite: GraphQL Search Request - Internal Error on Magento 2.3.4
By developing using GraphQL, Elastiscsuite tries to retrieve the index name from the Search Request (graphql_product_search). Which is not declared on vendor/smile/module-elasticsuite-catalog/etc/elasticsuite_search_request.xml. Therefore, this is not mapped on Elasticsearch as well.
Preconditions
Magento Version : EE 2.3.4 ElasticSuite Version : 2.8.4 Environment : Developer and Production Third party modules : -
Steps to reproduce
- Create a /graphql post/request (using Postman for example).
- Check the error response.
- Check Magento logs.
Expected result
GraphQL request should work as expected.
Actual result
The response is an Internal Error using Postman for example.
Magento exception log throws:
[2020-02-04 16:06:27] report.ERROR: index does not exist yet. Make sure everything is reindexed. {"exception":"[object] (GraphQL\\Error\\Error(code: 0): index does not exist yet. Make sure everything is reindexed. at /var/www/html/src/vendor/webonyx/graphql-php/src/Error/Error.php:174, LogicException(code: 0): index does not exist yet. Make sure everything is reindexed. at /var/www/html/src/vendor/smile/elasticsuite/src/module-elasticsuite-core/Index/IndexOperation.php:117)"} []
Thanks,
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 25
@fjmiguel and @idziakjakub can you try the fixes provided in this PR : https://github.com/Smile-SA/elasticsuite/pull/1699
It should be working with Magento 2.3.4 and also prevent him to query the engine with their “max page size” hacky thing.
This has also been tested against 2.3.3 : it will fallback to legacy Resolver.
Due to the fact their GraphQL implementation has completely changed in 2.3.4, I was forced to introduce this “fallback to legacy” behavior for older versions.
Let me know if you encounter issues.
@idziakjakub my PR is updated with a fix for
url_key: the field has to be declared as filterable so that building the ES query filter on it will succeed.Can you check this (you have to clean all cache & reindex before) ? This should be enough.
In any cases, I think I’ll rework everything related to GraphQL on next major Elasticsuite release (2.9.0) and might move it as a separated module rather than being in ElasticsuiteCatalog. I’ll probably have to also check that any potential attribute being used for filtering though graphQL is properly set as being filterable for Elasticsearch : previously, only attributes configured with “Filterable in search” for the layered navigation were.
Let me know how is these fixes going.
Regards
I’m using Magento 2.3.4, ElasticSearch 6.8.7, and ElasticSuite 2.8.5 but I’m still facing this issue:
var/log/debug.log
main.DEBUG: Source class "\elasticsuiteSearchResultApplier" for "elasticsuiteSearchResultApplierFactory" generation does not exist. {"exception":"[object] (RuntimeException(code: 0): Source class \"\\elasticsuiteSearchResultApplier\" for \"elasticsuiteSearchResultApplierFactory\" generation does not exist. at /var/www/magento/vendor/magento/framework/Code/Generator.php:222)"} []By the way, this error message is shown even if
ENABLE DEBUG MODEin Magento Backend is set toNO@romainruaud just to speed up things: we added here on src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/etc/elasticsuite_search_request.xml
<request name="graphql_product_search" label="Catalog Product Search" index="catalog_product" type="product" fulltext="true"> <filters> <filter name="stockFilter">Smile\ElasticsuiteCatalog\Model\Product\Search\Request\Container\Filter\Stock</filter> <filter name="visibleInSearch">Smile\ElasticsuiteCatalog\Model\Product\Search\Request\Container\Filter\VisibleInSearch</filter> <filter name="blacklistedProducts">Smile\ElasticsuiteCatalog\Model\Product\Search\Request\Container\Filter\SearchBlacklist</filter> </filters> <aggregations> <provider name="filterableAttributesProvider">searchFilterableAttributesProvider</provider> <aggregation xsi:type="termBucket" name="attribute_set_id" field="attribute_set_id"/> </aggregations> </request>And on file src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml inside node index identifier=“catalog_product” defaultSearchType=“product”:
<field name="price.from" type="double" nestedPath="price" /> <field name="price.to" type="double" nestedPath="price" />So far looks good. We are still testing it. But maybe this can be helpful for you.
I am facing the same issue in Magento EE 2.3.4 and tried solution given but it gives another problem. each products search query gives same error. for e.g.
gives below error response
Can you please provide the solution ASAP.
Yes, there is more work to be done, I expect to deliver it asap.
In any cases, considering the current state of GraphQL implementation in Magento backend, I am not being optimistic on building something on top of it when having a high volume catalog.
Just take a look at all the mess in this implementation : https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php#L85
“Current page must be set to 0 and page size to max for search to grab all ID’s as temporary workaround” => This works well with the Venia sample data considering they have only hundreds of products, but shall you have 100K+ products, you’ll face huge performance issues, if not a fatal error due to memory limit reached.
That being said, we must stay compatible with Magento’s implementation, even if their resolver looks risky for now.
About price filtering, @fjmiguel , I’m not sure it’s working at all on a legacy Magento implementation (look on https://venia.magento.com/ : all the filters seems to have nearly no effect).
If you are building something which is completely custom, I’d like to have a look on your GraphQL query.
Regards