cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

SOLVED

Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

Hi,

 

My setup have ElasticSearch 7.9.1 with Magento.

It's working when I use M2 2.4.0, but after upgraded to 2.4.1 it stop working.

It show the following message in log.

 

My search string is "app" but it didn't provide a result but the following error in log.

 

[2020-10-23 23:39:13] main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: For input string: \"ap ap\"","index_uuid":"FvWjTH5FS8iIeqm80hODCw","index":"magento2_product_2_v1577"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_2_v1577","node":"T-O_-7dMQSqTvn45K8g7cg","reason":{"type":"query_shard_exception","reason":"failed to create query: For input string: \"ap ap\"","index_uuid":"FvWjTH5FS8iIeqm80hODCw","index":"magento2_product_2_v1577","caused_by":{"type":"number_format_exception","reason":"For input string: \"ap ap\""}}}]},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: For input string: \\\"ap ap\\\"\",\"index_uuid\":\"FvWjTH5FS8iIeqm80hODCw\",\"index\":\"magento2_product_2_v1577\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_product_2_v1577\",\"node\":\"T-O_-7dMQSqTvn45K8g7cg\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: For input string: \\\"ap ap\\\"\",\"index_uuid\":\"FvWjTH5FS8iIeqm80hODCw\",\"index\":\"magento2_product_2_v1577\",\"caused_by\":{\"type\":\"number_format_exception\",\"reason\":\"For input string: \\\"ap ap\\\"\"}}}]},\"status\":400} at /var/sites/magento/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:632)"} []
[2020-10-23 23:39:13] main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: For input string: \"app app\"","index_uuid":"FvWjTH5FS8iIeqm80hODCw","index":"magento2_product_2_v1577"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_2_v1577","node":"T-O_-7dMQSqTvn45K8g7cg","reason":{"type":"query_shard_exception","reason":"failed to create query: For input string: \"app app\"","index_uuid":"FvWjTH5FS8iIeqm80hODCw","index":"magento2_product_2_v1577","caused_by":{"type":"number_format_exception","reason":"For input string: \"app app\""}}}]},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: For input string: \\\"app app\\\"\",\"index_uuid\":\"FvWjTH5FS8iIeqm80hODCw\",\"index\":\"magento2_product_2_v1577\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_product_2_v1577\",\"node\":\"T-O_-7dMQSqTvn45K8g7cg\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: For input string: \\\"app app\\\"\",\"index_uuid\":\"FvWjTH5FS8iIeqm80hODCw\",\"index\":\"magento2_product_2_v1577\",\"caused_by\":{\"type\":\"number_format_exception\",\"reason\":\"For input string: \\\"app app\\\"\"}}}]},\"status\":400} at /var/sites/magento/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:632)"}

Please let me know if you have any comment. Thank you.

 

Regards,

kf

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

Base on the bug filed in my previous reply, I modified the following file to fix the search problem.

 

./vendor/magento/module-elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

 

private const ES_DATA_TYPE_DOUBLE = 'double';
--> private const ES_DATA_TYPE_FLOAT = 'float';


self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
---> self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,

 

Regards,

kf

View solution in original post

6 REPLIES 6

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

I found there is an bug logged. But I need a workaround to make elasticsearch work asap.

https://github.com/magento/magento2/issues/30540

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

Base on the bug filed in my previous reply, I modified the following file to fix the search problem.

 

./vendor/magento/module-elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

 

private const ES_DATA_TYPE_DOUBLE = 'double';
--> private const ES_DATA_TYPE_FLOAT = 'float';


self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
---> self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,

 

Regards,

kf

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

Unfortunatly is does not solve the issue for us

Still having similar Critical failure.

Any other idea?

 

[2021-03-11 05:11:34] main.CRITICAL: {"index":"at24_product_1","type":"document","body":{"from":0,"size":12,"stored_fields":["_id","_score"],"sort":[{"position_category_4":{"order":"asc"}}],"query":{"bool":{"must":[{"term":{"category_ids":"4"}},{"range":{"price_0_1":{"gte":"4","lte":"100,4"}}},{"terms":{"visibility":["2","4"]}}]}},"aggregations":{"price_bucket":{"extended_stats":{"field":"price_0_1"}},"category_bucket":{"terms":{"field":"category_ids","size":500}},"aquariumgosse_bucket":{"terms":{"field":"aquariumgosse","size":500}},"aquariumlange_bucket":{"terms":{"field":"aquariumlange","size":500}},"batteries_included_bucket":{"terms":{"field":"batteries_included","size":500}},"color_bucket":{"terms":{"field":"color","size":500}},"delivery_time_bucket":{"terms":{"field":"delivery_time","size":500}},"farbe_bucket":{"terms":{"field":"farbe","size":500}},"forderleistung_bucket":{"terms":{"field":"forderleistung","size":500}},"halsumfang_bucket":{"terms":{"field":"halsumfang","size":500}},"identification_label_bucket":{"terms":{"field":"identification_label","size":500}},"inhalt_bucket":{"terms":{"field":"inhalt","size":500}},"leistung_bucket":{"terms":{"field":"leistung","size":500}},"literleistung_bucket":{"terms":{"field":"literleistung","size":500}},"manufacturer_bucket":{"terms":{"field":"manufacturer","size":500}},"produkttyp_bucket":{"terms":{"field":"produkttyp","size":500}},"size_bucket":{"terms":{"field":"size","size":500}},"stroemungsleistung_bucket":{"terms":{"field":"stroemungsleistung","size":500}},"swissup_rating_summary_bucket":{"terms":{"field":"swissup_rating_summary","size":500}},"tierbereich_bucket":{"terms":{"field":"tierbereich","size":500}},"unterschrank_bucket":{"terms":{"field":"unterschrank","size":500}},"use_batteries_bucket":{"terms":{"field":"use_batteries","size":500}},"uvb_bucket":{"terms":{"field":"uvb","size":500}},"wasserart_bucket":{"terms":{"field":"wasserart","size":500}},"wk_compliance_config_bucket":{"terms":{"field":"wk_compliance_config","size":500}}}},"track_total_hits":true} [] []

 

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

thank, it worked for me. also need clear cache and reindex after change

 

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

Not very clear to me.. Replace or add below?

 

Should it be like?

 

/**#@+
* Text flags for Elasticsearch field types
*/
private const ES_DATA_TYPE_STRING = 'string';
private const ES_DATA_TYPE_DOUBLE = 'double';
private const ES_DATA_TYPE_FLOAT = 'float';
private const ES_DATA_TYPE_INT = 'integer';
private const ES_DATA_TYPE_DATE = 'date';
/**#@-*/

/**
* Mapping between internal data types and elastic service.
*
* @var array
*/
private $mapping = [
self::INTERNAL_DATA_TYPE_STRING => self::ES_DATA_TYPE_STRING,
self::INTERNAL_DATA_TYPE_KEYWORD => self::ES_DATA_TYPE_STRING,
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,
self::INTERNAL_DATA_TYPE_INT => self::ES_DATA_TYPE_INT,
self::INTERNAL_DATA_TYPE_DATE => self::ES_DATA_TYPE_DATE,
];

Re: Magento 2.4.1 ElasticSearch 7.9.1 not working suddenly

@jorgb Tried your edit but this still doesn't fix the issue