【问题标题】:Create FOSElasticaBundle action in controller在控制器中创建 FOSElasticaBundle 动作
【发布时间】:2015-05-24 20:57:02
【问题描述】:

我决定处理 ElasticSearch。马上面临在控制器中写action的问题。这是我的配置。有人可以写一个小例子来说明如何在这些字段中使用这个包

fos_elastica:
clients:
    default: { host: localhost, port: 9200 }

【问题讨论】:

标签: symfony foselasticabundle


【解决方案1】:

您可以使用该命令填充索引php app/console fos:elastica:populate

然后查找可以在控制器操作中使用的用户:

$finder = $this->container->get('fos_elastica.finder.search.user');

// Option 1. Returns all users who have example.net in any of their mapped fields
$results = $finder->find('example.net');

就像在文档中一样,它通常是不言自明的:

https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/usage.md

如果您的代码有问题,我们可能会提供帮助,如果您想要一个示例,它已经存在,我只是复制粘贴它,因为没有太多要添加的内容。

【讨论】:

    猜你喜欢
    • 2011-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-28
    • 2010-10-22
    • 1970-01-01
    相关资源
    最近更新 更多