gpt4 book ai didi

php - 在Elasticsearch中定义搜索规则

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

如何将这两个查询组合在一起,以便可以在一个查询中按名称,具有一种类型的规则的发布者和按不同规则的集合进行搜索?

          'must'=> [
[
"multi_match" => [
"query" => $this->builder->query,
"fields" => ['name', 'publisher', 'platform'],
"fuzziness" => 'auto',
"prefix_length" => 1,
],

"match" => [
"query" => $this->builder->query,
"fields" => ['ean'],
"prefix_length" => 1
],
]
]

最佳答案

我用这段代码解决了我的问题

           'should'=> [
[
"multi_match" => [
"query" => $this->builder->query,
"fields" => ['name', 'publisher', 'platform'],
"fuzziness" => 'auto',
"prefix_length" => 1,
'operator' => 'or'
],
],
[
"match" => [
"ean" => $this->builder->query,
],
]
]

关于php - 在Elasticsearch中定义搜索规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49296312/

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