magento2: Elasticsearch parsing exception

Preconditions (*)

  1. Magento 2.3.1 or current 2.3-develop branch
  2. Elasticserach 6.7.1

Steps to reproduce (*)

  1. Add dropdown product attribute with:
    • Scope: global scope
    • Unique value: no
    • Add to Column options: yes
    • Use inf Filter options: yes
    • Use in search: yes
  2. Search for a term used in one of the dropdown’s options.

Expected result (*)

  1. Search results based on Elasticsearch

Actual result (*)

  1. Fallback search results based on MySQL search
  2. Exception:
[2019-04-25 08:06:28] main.CRITICAL: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":115}],"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":115},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"parsing_exception\",\"reason\":\"[terms] unknown token [START_ARRAY] after [in]\",\"line\":1,\"col\":115}],\"type\":\"parsing_exception\",\"reason\":\"[terms] unknown token [START_ARRAY] after [in]\",\"line\":1,\"col\":115},\"status\":400} at /home/xxx/public_html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:615)"} []
  1. Query sent to Elasticsearch looks like this:
"query": {
        "bool": {
            "must": [
                {
                    "term": {
                        "category_ids": "222"
                    }
                },
                {
                    "terms": {
                        "manufacturer": {
                            "in": [
                                "166",
                                "53",
                                "65",
                                "66",
                                "164"
                            ]
                        }
                    }
                }
            ]
        }
    },

This isn’t valid ES query, manufacturer in terms shouldn’t include in parameter. When I manually tested without in it worked without any problem.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 21 (9 by maintainers)

Most upvoted comments

Any news regarding this issue?

@sigismund and @MagentoSeba,

Thank you for your report and collaboration!

The issue has been fixed by Magento team in the scope of internal Jira tickets MC-20381 and MAGETWO-99427 The fix has been delivered into 2.3-develop branch

Related commit(s):

Hello @MagentoSeba

Thank you for the input and collaboration!

The issue was closed by mistake - were used not accurate steps to reproduce/preconditions. Now internal team has confirmed that issue can be reproduced by provided steps. The issue will be resolved in the scope of internal Jira ticket MAGETWO-99427 by Magento team

As soon as it will be delivered into 2.3-develop, we provide a list of commits here as a comment.

✅ Confirmed by @sdzhepa Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-99427 were created

Issue Available: @sdzhepa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

sure @sidolov !

The main error is :

[2019-04-30 11:34:00] report.CRITICAL: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":183}],"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":183},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"parsing_exception\",\"reason\":\"[terms] unknown token [START_ARRAY] after [in]\",\"line\":1,\"col\":183}],\"type\":\"parsing_exception\",\"reason\":\"[terms] unknown token [START_ARRAY] after [in]\",\"line\":1,\"col\":183},\"status\":400} at /mnt/data/www/client/releases/DEV-release-350/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:610)"} []

The query in our case is : image

If query modified by removing “in”, Elasticsearch works as expected.

@sigismund the issue is actually also in Magento Commerce 2.3.0, the @magento-engcom-team should be aware of that.

✅ Confirmed by @engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-99427 were created

Issue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.