建议不支持[field]

时间:2018-10-10 15:18:40

标签: elasticsearch foselasticabundle

使用FOSElasticaBundle v5.0.3 fos_elastica.finder.post_index.post服务获取在我的映射配置下定义的 available sugesstion帖子列表:

fos_elastica:
    clients:
        default: { host: elasticsearch, port: 9200 }
    indexes:
        post_index:
            client: default
            index_name: post_index
            types:
                post:
                    properties:
                        suggest:
                            type: completion
                        id:
                            type: keyword
                        title:
                            type: keyword
                        description:
                            type: keyword

                    persistence:
                        driver: orm
                        model: App\Entity\Post
                        finder: ~
                        provider: ~
                        listener: ~

这是我在SearchController下的php代码:

$finder = $this->container->get('fos_elastica.finder.post_index.post');

$compelation = [
        "suggest" => [
            "suggest" => [
                "text" => "test",
                "completion" => [
                    "field" => "suggest",
                    "fuzzy" => ["fuzziness" => 2]
                ],
            ]
        ]
    ];

$result = $finder->find($compelation);

发布请求在kibana控制台下效果很好,并返回预期结果:

POST post_index/_search?pretty
{
    "suggest": {
        "anything-suggest" : {
            "text" : "test",
            "completion" : {
                "field" : "suggest",
                "fuzzy" : {
                    "fuzziness" : 2
                }
            }
        }
    }
}

这是我得到的错误:

  

建议不支持[字段]

我的弹性搜索版本为5.6.12,我们将不胜感激。 谢谢。

0 个答案:

没有答案