elasticsearch - [index] 中 VALUE_STRING 的未知键

标签 elasticsearch foselasticabundle

我正在尝试找到一种方法来构建我的 $params 数组,使用 native 语法来搜索名称等于“test”的帖子:

$params = [
    "index" => "post_index",
    "type" => "post",
    'body' => [
        'query' => [
            'match' => [
                'name' => 'test'
            ]
        ]
    ]
];
$result = $finder->find($params);

不幸的是我收到了这个错误:

Unknown key for a VALUE_STRING in [index].

我知道我可以使用一些 Elastic\Query\Match 来构建我的查询。

最佳答案

只是我用这种方式修复了我的 $params 数组:

$q = [
    'query' => [
        'match' => [
            'title' => 'test'
        ]
    ]
];

关于elasticsearch - [index] 中 VALUE_STRING 的未知键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52742121/

相关文章:

elasticsearch - 想要添加范围时如何在没有查询的情况下与elasticsearch聚合?

api - 如何配置Logstash以向APIGEE Analytics API发出请求?

python - Elasticsearch DSL。在聚合内部构建边界框过滤器

search - Elasticsearch 的个性化搜索结果

elasticsearch - ElasticSearch has_child查询什么都找不到

sorting - ES按距离排序时出现错误

elasticsearch - 在elasticsearch的should bool子句中,默认评分模式是什么?

php - 如何在已编入索引的文档上使用摄取管道?

symfony - FOSElasticaBundle上的未定义索引

elasticsearch - 按 timeUpdated 排序,如果存在,否则 timeCreated