我决定处理 ElasticSearch。马上面临在控制器中写action的问题。这是我的配置。有人可以写一个小例子来说明如何将这个捆绑包用于这些字段
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
我决定处理 ElasticSearch。马上面临在控制器中写action的问题。这是我的配置。有人可以写一个小例子来说明如何将这个捆绑包用于这些字段
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
您可以使用该命令来填充索引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
如果您的代码有问题,我们可能会提供帮助,如果您想要一个示例,它已经存在,我只是复制粘贴它,因为没有太多要添加的内容。