【问题标题】:Elastic search 1.4 and Drupal 7 : use array in queryElastic search 1.4 和 Drupal 7:在查询中使用数组
【发布时间】:2017-01-24 23:17:13
【问题描述】:


在 PHP Drupal 中,我希望在“field_xxx”字段中发出一个请求,其中包含多个标识:id=106 AND id=105(如过滤器)。
我尝试了多种解决方案均未成功。
有人可以帮助我吗?非常感谢

$searchParams = [
    'index' => 'indextest,
    'type' => 'index_test',
    'body' => [
        'query' => [
            'bool' => [
                'must' => [
                    [ 'match' => [ 'title' => 'the cat' ] ],
                    [ 'match' => [ 'field_xxx' => ['106','105'] ] ],
                ]
            ]
        ]
    ]
];



$searchParams['body']['query']['match']['title'] = "Le jeu de la dame";
$searchParams['body']['query']['bool']['must']['field_support']= '106,105';

【问题讨论】:

  • 我试过了:[ 'term' => [ 'field_support' => '106'] ] 没关系
  • 但我有一个错误:[ 'term' => [ 'field_support' => '106','105' ] ]

标签: php elasticsearch drupal


【解决方案1】:

我认为terms 查询会很有用。

看看this

【讨论】:

    猜你喜欢
    • 2011-08-29
    • 2016-02-19
    • 1970-01-01
    • 2022-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    相关资源
    最近更新 更多