'Magento 2 + Elasticsearch + We can't find products matching the selection

I installed a testshop with Magento 2 and made a clone of this testshop.

Everytime when I configurate Magento 2 that it should use Elasticsearch I get this error: "we can't find products matching the selection" when I click on a Category.

I saw that there is a prefix and it was the same at the testshop + clone. So I changed the prefix but I'm still getting this error. Can somebody help?

Magento 2.3.7

Elasticsearch: 7

I'm reindexing and flushing the chache everytime when I change from MySQL to Elasticsearch.

I also deleted all Indices an Elasticsearch already.

Test connection is also ok.

Magento 2 Config

Reindex

Elasticsearch



Solution 1:[1]

I found the solution.

in my debug.log there was:

[2022-05-12 11:20:18] main.CRITICAL: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [weight] ....

So i checked the Attribute weight and it was set yes

I changed it to no. Reindex and now I can see the products.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 General Grievance