cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.1 Elasticsearch 7.6 not working

Magento 2.4.1 Elasticsearch 7.6 not working

Hi,

Can anyone help me to find the issue on following this:

hit the URL: https://amarfist.com/catalogsearch/result/?cat=&q=Rice

build on magento 2.4.1(Community)
elasticsearch version 7.6.0

Why search returned like that?

Admin setting is ok with community guideline.
But I don't understand what is the issue?
Elasticserach log shows:
Caused by: java.lang.NumberFormatException: For input string: "Rice"
at jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054) ~[?:?]
at jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) ~[?:?]
at java.lang.Double.parseDouble(Double.java:549) ~[?:?]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType.objectToDouble(NumberFieldMapper.java:876) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType.access$200(NumberFieldMapper.java:173) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$3.parse(NumberFieldMapper.java:369) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$3.termQuery(NumberFieldMapper.java:388) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberFieldType.termQuery(NumberFieldMapper.java:928) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.search.MatchQuery$MatchQueryBuilder.lambda$newTermQuery$1(MatchQuery.java:576) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.search.MatchQuery$MatchQueryBuilder.newTermQuery(MatchQuery.java:579) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.search.MatchQuery.parse(MatchQuery.java:277) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.MatchQueryBuilder.doToQuery(MatchQueryBuilder.java:426) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:99) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:394) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:380) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:99) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:334) ~[elasticsearch-7.6.0.jar:7.6.0]
at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:346) ~[elasticsearch-7.6.0.jar:7.6.0]
... 17 more

1 REPLY 1

Re: Magento 2.4.1 Elasticsearch 7.6 not working

By changing these

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,