Magento2: Elasticsearch parsing exception

Created on 25 Apr 2019  路  21Comments  路  Source: magento/magento2

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.

Elasticsearch dmcdindia1 Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.3.x

Most helpful comment

Any news regarding this issue?

All 21 comments

Hi @sigismund. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@sigismund do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @Nazar65. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

:white_check_mark: 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._

Hi @GovindaSharma. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

dmcdindia1

Hi @ashutoshwebkul. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Any news regarding this issue?

any news? In my case I get this error using elasticsearch5

main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v41","node":"DlRawzy2QsiSXBGwxwenjw","reason":{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41","caused_by":{"type":"number_format_exception","reason":"For input string: "{""}}}]},"status":400} {"exception":"[object] (ElasticsearchCommonExceptionsBadRequest400Exception(code: 400): {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v41","node":"DlRawzy2QsiSXBGwxwenjw","reason":{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41","caused_by":{"type":"number_format_exception","reason":"For input string: "{""}}}]},"status":400} at /var/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:636)"} []

same here ... Magento 2.3

[2019-08-12 11:29:47] main.CRITICAL: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":153}],"type":"parsing_exception","reason":"[terms] unknown token [START_ARRAY] after [in]","line":1,"col":153},"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\":153}],\"type\":\"parsing_exception\",\"reason\":\"[terms] unknown token [START_ARRAY] after [in]\",\"line\":1,\"col\":153},\"status\":400} at /public_html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:615)"} []

@sigismund did you find a solution?

Not really, I lost hope with this bug. It seems like another of Magento bugs that isnt't gonna get solved, because enterprise edition doesn't have a problem with it ;)

I made a switch to ElasticSuite solution. It's open source, has additional settings and it works.

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

Hi @sigismund, @GovindaSharma, @ashutoshwebkul.

Thank you for your report and collaboration!

The related internal Jira ticket MAGETWO-99427 was closed as non-reproducible in 2.3-develop.
It means that Magento team either unable to reproduce this issue using provided _Steps to Reproduce_ from the _Description section_ on clean Magento instance or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the _Description section_ and reopen this issue.

@magento-engcom-team @sigismund @GovindaSharma and @ashutoshwebkul did you take into account that is a different version of ElasticSearch as of 2.3.2.
This issue is applicable to 2.3.0 and 2.3.1.

@MagentoSeba we will check once again, thank you for the input! Maybe you have more information about it, it would be great to add it here. Thank you!

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.

@sdzhepa Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

  • [ ] Add "Reproduced on " label(s) to this ticket based on verification result

Once all required information is added, please add label "Issue: Confirmed" again.
Thanks!

:white_check_mark: 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._

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.

@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):

any news? In my case I get this error using elasticsearch5

main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v41","node":"DlRawzy2QsiSXBGwxwenjw","reason":{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41","caused_by":{"type":"number_format_exception","reason":"For input string: "{""}}}]},"status":400} {"exception":"[object] (ElasticsearchCommonExceptionsBadRequest400Exception(code: 400): {"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v41","node":"DlRawzy2QsiSXBGwxwenjw","reason":{"type":"query_shard_exception","reason":"failed to create query: {
  "bool" : {
    "must" : [
      {
        "term" : {
          "category_ids" : {
            "value" : "279",
            "boost" : 1.0
          }
        }
      },
      {
        "terms" : {
          "visibility" : [
            "2",
            "4"
          ],
          "boost" : 1.0
        }
      },
      {
        "terms" : {
          "manufacturer" : [
            "{",
            "eq",
            "948",
            "}"
          ],
          "boost" : 1.0
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}","index_uuid":"V1_G2RWGQP-O-G9iNIoh9w","index":"magento2_product_1_v41","caused_by":{"type":"number_format_exception","reason":"For input string: "{""}}}]},"status":400} at /var/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:636)"} []

I am having this issue in M2.3.3

Was this page helpful?
0 / 5 - 0 ratings