elasticsearch | php 6.0错误的结果

时间:2019-02-27 15:00:21

标签: php elasticsearch elasticsearch-php

我对我的Elasticsearch 6.5的查询有问题。我已经安装了elasticsearchphp 6.0。当我开始这个查询时,我会得到错误的结果,以及其他索引的结果,不仅来自“ search_article_index”

        $params = [
        'index' => 'search_article_index',
        'body' => [
            'query' => [
                'match' => [
                    'name' => 'test',
                ],
            ],
        ],
    ];

    try {
        $response = $client->search(json_encode($params));
    } catch (\Exception $ex) {
        $result[] = [
            'source' => 'nothing found',
            'title' => '',
            'href' => '#',
        ];

        return $result;
    }

    foreach ($response['hits']['hits'] as $row) {
        var_dump($row);
    }

当我将其删除时,我也包含了json_encode,然后出现以下错误消息:

  

ERR(3):Elasticsearch \ Common \ Exceptions \ BadRequest400Exception:{“错误”:“不支持Content-Type标头[]”,“状态”:406}

有人可以帮助我吗?

0 个答案:

没有答案