0

I have upgraded the version of magento from 2.2.6 to 2.4.3 in local, so after that i have check the magento search product functionality, so it's not working as screenshot attached: https://i.stack.imgur.com/R6Kva.png https://i.stack.imgur.com/CxWlf.png

I have also disabled third party extensions, also does re-indexing, also check magento catalog search configurations but all are set as magento default but still not work, please help me if anyone have idea...thank you

I got below error in exception.log: [2021-09-23 04:36:24] 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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v678","node":"tz_4_7g6TcST59TM_qIXCQ","reason":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} {"exception":"[object] (Elasticsearch\Common\Exceptions\BadRequest400Exception(code: 400): {"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v678","node":"tz_4_7g6TcST59TM_qIXCQ","reason":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"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 [gift_price] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} at /var/www/html/www.carstensens-tehandel.dk/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:675)"} []

1
  • any solution for this
    – Pawankumar
    Apr 8, 2022 at 13:59

4 Answers 4

0

Most likely reason is that you are lacking ElasticSearch installed, which is a Magento 2 requirement since 2.3. If this proves to be the case, all category pages will also return the same error.

Check correct version at https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

See var/log/exception.log - if you see Elasticsearch related errors, that's the case.

Once installed, check connection in Stores > Configuration > Catalog > Catalog > Catalog Search > [Test Connection] button.

Once connection is successful, issue bin/magento indexer:reindex catalogsearch_fulltext.

Beware that Full page cache seems to cache this error, so once fixed, please do bin/magento cache:clean full_page to verify.

1
  • I have check the elasticsearch version then it is latest : 7.14.2 also it's working on my second magento which i have install fresh m243. also does reindexing & caching still not works, i have upgraded it from m2.2.6 to m.2.4.3, please check my question is edited now, which contains exception.log errror....thank you Sep 23, 2021 at 4:35
0

You can go to CLI and execute command to check whether its installed or not

service elasticsearch status.

2
0

You might want to give the Elasticsuite module a try. For my taste, it works better than the default Magento Elasticsearch module but your mileage may vary.

0

Can you post the attributes that you have set to searchable. What's the data type associated with the attributes.

Also you need to make sure that the elastic search needs to be reindexed. We faced the same problem.

The finding was that one of the attribute was from an external module and was set to search as true while that attribute was not getting indexed.

SO if any external modules adding attributes as searchable first those from searchable, Reindex attributes then reindex search and check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.