gpt4 book ai didi

laravel - Laravel框架的 Elasticsearch 查询

转载 作者:行者123 更新时间:2023-12-03 01:12:41 25 4
gpt4 key购买 nike

我是 flex 搜索的新手。我正在尝试从 flex 搜索中获取记录。

$params = Array
(
[index] => elastic_index
[size] => 10
[body] => Array
(
[query] => Array
(
[bool] => Array
(
[must] => Array
(
[match] => Array
(
[uniqueField] => uniqueValue
)

)

[filter] => Array
(
[range] => Array
(
[intValue] => Array
(
[lte] => 120
)

)

[terms] => Array
(
[type] => Array
(
[0] => some
[1] => values

)

)

)

)

)

)

)
$data = $Elasticsearch\ClientBuilderObject->search($params);
因此,没有范围筛选器的查询正在工作,但是当我尝试对其进行筛选时,出现以下错误。
{“error”:{“root_cause”:[{“type”:“parsing_exception”,“reason”:“[range]格式错误的查询,预期[END_OBJECT],但找到了[FIELD_NAME]”,“line”:1,“col “:97}],” type“:” parsing_exception“,”原因“:” [范围]格式错误的查询,预期[END_OBJECT],但发现[FIELD_NAME]“,” line“:1,” col“:97},”状态”:400}
我检查了文档,但找不到任何解决方案。如果您在这里给我一些提示或可以解决我的问题的网站,我将不胜感激。

最佳答案

我猜您正在构建这样的数组?

"filter" => [
"range" => [
"intValue" => [
"lte" => 120
]
],
"terms" => [
"type" => ["some", "values"]
]
]
您可以尝试将其更改为此吗?
"filter" => [
[
"range" => [
"intValue" => [
"lte" => 120
]
]
],
[
"terms" => [
"type" => ["some", "values"]
]
]
]

关于laravel - Laravel框架的 Elasticsearch 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63703819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com