TransWikia.com

Elasticsearch "illegal_argument_exception" when trying to search by string type

Magento Asked by fortegente on December 12, 2021

I’ve setup Elasticsearch on magento and when trying to search by any string I’m getting an error

illegal_argument_exception: Invalid format: "search string"

I found out that when I removed all datetime attribute I’ve got another error

number_format_exception: For input string: "search string"

And I understand that now something wrong with int type attributes

When I’m searching by int everything is ok, result is there.

My suggestion – Elasticsearch created incorrect mapping (I didn’t created it by hand it was done automatically after reindex products) but I wonder how to check this to be sure. Or have I ability to setup my own mapping.

3 Answers

Most likely one of your int or decimal attributes is searchable. Try to find them by using the following SQL query:

SELECT * FROM eav_attribute e
LEFT JOIN catalog_eav_attribute cea ON e.attribute_id = cea.attribute_id
WHERE e.backend_type = 'decimal'
AND cea.is_searchable = 1
AND e.frontend_input != 'price';

If you find decimal attribute which is searchable try to make it as Not Searchable

  • Go to admin -> store -> attributes -> product -> find the attribute
  • Edit attribute and make it NOT Searchable
  • Run full reindex php bin/magento index:reinde catalogsearch_fulltext

Answered by Yaroslav Voronoy on December 12, 2021

This issue may occurs when you are using an older version of Elastic search. For example Magento 2.3 comes with Elasticsearch and Elasticsearch 5.0+ versions. You must have elasticsearch 5 installed as engine and select the Elasticsearch 5.0+ as search engine in Magento admin.

Furthermore as of time of writing I have found out that Elasticsearch 6 doesn't cope well with Magento. Elasticsearch 5 is fine.

Answered by user1105491 on December 12, 2021

I had the same problem with search string. With ES 2.4.6.I solved it change property of an attribute datetype to NOT use in search. I saw that there is an issue with date maping (when searching by string)

Answered by Enrique Guadalupe on December 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP