ElasticSeach查询多重匹配未正确过滤

时间:2018-07-06 16:10:18

标签: elasticsearch

这是我的查询:

$query = [
    'sort' => [
        [
            'created_at' => [
                'order' => 'desc',
            ],
        ],
    ],
    'query' => [
        'bool' => [
            'filter' => [
                'term' => [
                    'platform_environment' => 'foo',
                ],
            ],
            'must' => [
                [
                    'multi_match' => [
                        'query' => 'qwerty-12345',
                        'fields' => [
                            'endpoint',
                            'response',
                        ],
                    ],
                ],
            ],
        ],
    ],
];

然后我像这样呼叫\ElasticSearch\Client

$results = $elasticsearchClient->search([
    'index' => 'api-calls',
    'type' => 'call',
    'body' => $query,
    'from' => $from,
    'size' => $pageSize,
]);

我要解决的问题是在分页结果的最后一页上-没有记录(总共148个中有22个)带有字符串qwerty-12345-并且在所有记录中都带有该字符串前一页(分页集)。

在遍历每条记录并尝试查找或找不到qwerty-12345之前,我可以只检查查询是否满足我的要求吗?

返回的唯一响应应该是在qwerty-12345endpoint文本字段中带有response的响应。或两者皆有!

正确吗?

0 个答案:

没有答案