无法解析布尔值[0],在elasticsearch 7.17和shopware 6.4中应为[true]或[false]

zf2sa74q  于 2023-09-27  发布在  ElasticSearch
关注(0)|答案(1)|浏览(170)

我有Shopware 6.4和ElasticSearch 7.17的工作环境。只有在某些情况下才会返回例外,大多数搜索词都能找到。没有木花与ES合作。在日志中显示了一个问题“无法解析布尔值[0],预期为[true]或[false]"。我真的不知道在哪里寻找解决这个问题的方法或提示。我知道,从es版本6只有真或假的工作。有没有可能商店中的一些插件可能会这样做?
任何提示都可能有帮助。
下面是日志错误:

  1. [2023-09-15T08:48:23.462839+00:00] request.CRITICAL: Uncaught PHP Exception Elasticsearch\Common\Exceptions\BadRequest400Exception: "{"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: Can't parse boolean value [0], expected [true] or [false]","index_uuid":"Z-KvxYVyRzKeSEKaV23k6w","index":"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320","node":"yW9O2-UCSlCoYctoSmeXPQ","reason":{"type":"query_shard_exception","reason":"failed to create query: Can't parse boolean value [0], expected [true] or [false]","index_uuid":"Z-KvxYVyRzKeSEKaV23k6w","index":"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320","caused_by":{"type":"illegal_argument_exception","reason":"Can't parse boolean value [0], expected [true] or [false]"}}}]},"status":400}" at /vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php line 693 {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: Can't parse boolean value [0], expected [true] or [false]\",\"index_uuid\":\"Z-KvxYVyRzKeSEKaV23k6w\",\"index\":\"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320\",\"node\":\"yW9O2-UCSlCoYctoSmeXPQ\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"failed to create query: Can't parse boolean value [0], expected [true] or [false]\",\"index_uuid\":\"Z-KvxYVyRzKeSEKaV23k6w\",\"index\":\"sw_product_2fbb5fe2e29a4d70aa5854ce7ce3e20b_1694688320\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"Can't parse boolean value [0], expected [true] or [false]\"}}}]},\"status\":400} at /vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:693)"} []

我试着在网上找到一些解决办法。到目前为止没有任何帮助。

o2rvlv0m

o2rvlv0m1#

尝试在DB和ElasticSearch中检查列的DataType。
看起来,你在Elastic中有一个BooleanField,因此,ElasticSearch期望值为true/false(Boolean),而不是发送值为0(Boolean)。
Eg.
如果我的Elastic中的is_deleted字段是一个布尔字段,那么,下面的,具有一个布尔值,将失败。
"terms": {"is_deleted": [0]}
我需要将其更改为以下内容:
"terms": {"is_deleted": [false]}

相关问题