gpt4 book ai didi

php - 多个查询返回错误为什么?

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

我想基于源进行查询,因此我将条件放在我的基本查询中,它应始终基于源进行查询,其中源值存储在变量$ webAddress中。

如果未选择任何内容,则应运行默认查询,但总是返回一个奇怪的错误!

错误信息 - -

enter image description here

所以为什么我收到这个错误,任何人都知道如何解决这个奇怪的问题!

非常感谢高级。

enter image description here

  1. at AbstractJsonSerializer ::jsonDecode ('{"took":291,"timed_out":false,"_shards":{"total":2,"successful":2,"failed":0},"hits":{"total":10,"max_score":0.94276774,"hits":[{"_index":"myIndex","_type":"myType","_id":"p717ff3c9460bf8a52407d6e4a63f239dbeb052cf","_score":0.94276774,"_source":{ "content": "A beautiful backyard has become a suburban status symbol much like a brand-new car in the driveway. Upgrading your outdoor space is not only uplifti ......} in vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php at line 39 +

  2. at SmartSerializer ->deserialize ('{"took":291,"timed_out":false,"_shards":{"total":2,"successful":2,"failed":0},"hits":{"total":10,"max_score":0.94276774,"hits":[{"_index":"myIndex","_type":"myType","_id":"p717ff3c9460bf8a52407d6e4a63f239dbeb052cf","_score":0.94276774,"_source":{ "content": "A beau ....}

    4.at Transport ->performRequest ('GET', '/myType/content/_search', array('size' => '30'), array('query' => array('bool' => array('must' => array(array('query_string' => array('default_field' => 'source', 'query' => 'aa.com', 'bb.com', 'cc.com'))))), 'sort' => array())) in vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php at line 86 +

  3. at AbstractEndpoint ->performRequest () in vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php at line 1012 +



如果我打印正在执行的查询,我会得到-
{
"index": "myIndex",
"type": "myType",
"size": 30,
"body": {
"query": {
"bool": {
"must": [
{
"query_string": {
"default_field": "source",
"query": "aa.com, bb.com, cc.com"
}
}
]
}
},
"sort": []
} }

最佳答案

在您的PHP代码中,您插入了query/bool/must组合两次。只需删除第一个,就可以了。

    $params = array(
'index' => "myIndex",
'type' => "myType",
'xize' => 100,
'body' => array(
'query' => array(
'bool' => array(
'must' => array(

)
)
),
'sort' => array()
)
);

$params['body']['query']['bool']['must'][] = array(
'query_string' => array(
'default_field' => 'source',
'query' => implode(', ', array_column($webAddress, 'source'))
)
):

关于php - 多个查询返回错误为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32331344/

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