标签: foselasticabundle

与更新的实体相关的所有实体的Symfony2 FOSElasticaBundle更新索引

我在我的项目中使用FOSElasticaBundle和Doctrine,我的代码用于使用Doctrine生命周期事件进行选择性索引更新.我遇到的问题是我是否单独更新相关实体.

例如,一个人可能通过多种关系与公司相关.如果我直接通过公司实体更新公司名称,那么与公司相关的人员的索引将过时,并且仍与公司的旧名称相关.

关于如何处理这个我有点迷失,有人有什么建议吗?我是否必须依赖计划的索引更新并同时处理不准确的索引数据,或者我是否可以调用与已更新的实体相关的实体的更新.

我依靠JMSSerializer组来建立映射.我很欣赏这可能不是长期做事的最佳方式.

doctrine symfony symfony-2.4 foselasticabundle

13
推荐指数
2
解决办法
7724
查看次数

ElasticSearch RoutingMissingException

我正在尝试填充具有父子关系的对象,但是收到错误:

[Elastica\Exception\ResponseException] RoutingMissingException [[myindex]/[comment]/[12345]]需要路由

摘录类型conf:

article:
    _source:
        enabled: false
    mappings:
        ...

comment:
    _source:
        enabled: false
    _parent:
        type: article
        property: article_id
        identifier: id
    _routing:
        required: true
        path: article_id
    mappings:
        article:
            type: long
            index: not_analyzed
        ...
Run Code Online (Sandbox Code Playgroud)

不能理解我在这里失踪的东西....

我正在使用Symfony2.3,FOSElasticaBundle 3.0,ElasticSearch 1.2.2

elasticsearch symfony-2.3 foselasticabundle

11
推荐指数
2
解决办法
8238
查看次数

FOSElasticaBundle和Doctrine Hydration

我正忙着检查一下我正在开始的新项目的弹性搜索.我目前正在运行Symfony2.5,使用最新的FOSElasticaBundle以及所有这些.我正在对捆绑的性能做一些基准测试(我知道弹性本身非常快),但是我遇到了一个实际上很容易解决的小问题,如果只是捆绑的文档更冗长.

我的实际问题是如何,而不是返回一个Doctrine对象数组(我相信通过数据库查询填充),而不是从Elastica本身返回响应的"原始"数组?包括响应时间,最大分数等.FOSElasticaBundle的文档对这些主题非常模糊......

当你已经掌握了弹性的所有信息时,重新查询数据库似乎有点适得其反,而且速度慢?或者有一些非常明显的东西我在这里失踪了吗?

谢谢你的帮助!

symfony doctrine-orm elasticsearch foselasticabundle

9
推荐指数
1
解决办法
2193
查看次数

填充FOSElasticaBundle/Symfony2时ResponseExeption出错

我想让FOSElasticaBundle工作.ElasticSearch Instance正在localhost:9200上运行并响应.

我按照文档中的每一步https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md

但在最后一步,我在我的控制台中收到此错误:

c:\xampp\htdocs\my\folder>php app/console fos:elastica:populate
Resetting app

Fatal error: Wrong parameters for Exception([string $exception [, long $code [,
Exception $previous = NULL]]]) in C:\xampp\htdocs\my\folder\vendor\rufli
n\elastica\lib\Elastica\Exception\ResponseException.php on line 34

[Symfony\Component\Debug\Exception\FatalErrorException]

Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])


fos:elastica:populate [--index[="..."]] [--type[="..."]] [--no-reset] [--offset="..."] [--sleep="..."] [--batch-size="..."] [--ignore-errors] [--no-overwrite-format]
Run Code Online (Sandbox Code Playgroud)

看起来"__construct"-Function必须有3个参数,但只有2个参数.我只是尝试添加"NULL"参数以使其工作,但随后另一个函数抛出错误.

public function __construct(Request $request, Response $response)
{
    $this->_request = $request;
    $this->_response = $response;
    parent::__construct($response->getError());
}
Run Code Online (Sandbox Code Playgroud)

这是个常见的问题吗?我该如何解决?

exception symfony elastica foselasticabundle

6
推荐指数
1
解决办法
3234
查看次数

用于symfony 3的FOSElasticaBundle?

我希望将FOSElasticaBundle集成到我的symfony 3项目中.目前这个捆绑包不支持symfony 3.我正在研究我还能做些什么才能实现它?

php symfony elasticsearch foselasticabundle

6
推荐指数
1
解决办法
1624
查看次数

FOS Elastica - 获取查询的字符串表示形式

我正在对使用FOS Elastica的存储库进行单元测试,我想知道是否有人知道如何获取查询的字符串版本,而不是数组形式.这是我的存储库方法:

    /**
     * Creates query object by either first or last name, with given parameters
     *
     * @param $name
     *
     * @param array $params
     *
     * @return Query
     */
    public function findByFirstOrLast($name, array $params)
    {
        $queryString = new QueryString();
        $queryString->setQuery($name);
        $queryString->setFields(array('firstName', 'lastName'));


        $query = new Query();
        $query->setQuery($queryString);
        $query->setSort(array($params['sort'] => array('order' => $params['direction'])));

        return $query;
    }
Run Code Online (Sandbox Code Playgroud)

假设$name = 'foo';(我正在对id进行排序),我相信相应的FOS Elastica查询应该是

{
    "query":
    {
        "query_string":
            {
                "query":
                    "foo",
                    "fields":["firstName","lastName"]
            }
    },
    "sort":
    {
      "id":
          {
              "order":"asc"
          }
    }
} …
Run Code Online (Sandbox Code Playgroud)

elasticsearch symfony-2.3 foselasticabundle

5
推荐指数
1
解决办法
5238
查看次数

如何正确配置FOS Elastica分析仪和过滤器?

在我的 symfony2 应用程序中,我使用 FOS Elastica 捆绑包来执行搜索。

我尝试设置分析器和过滤器,但似乎它们没有效果。例如,如果我搜索单词“蛋糕”,则不会返回包含句子大小写“蛋糕”的对象。

如何正确配置这些分析器和过滤器?

我的配置:

#Elastic Search
fos_elastica:
    default_manager: orm
    clients:
        default: { host: localhost, port: 9200 }
    indexes:
        website:
            client: default
            settings:
                index:
                    analysis:
                        analyzer:
                            custom_index_analyzer :
                                type     :    custom
                                tokenizer:    nGram
                                filter   :    [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
                            custom_search_analyzer :
                                type     :    custom
                                tokenizer:    nGram
                                filter   :    [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
                        tokenizer:
                            nGram:
                                type:     nGram
                                min_gram: 1
                                max_gram: 2
                        filter:
                            snowball:
                                type:     snowball
                                language: French
                            elision:
                                type:     elision
                                articles: [l, m, …
Run Code Online (Sandbox Code Playgroud)

search analyzer symfony elastica foselasticabundle

5
推荐指数
1
解决办法
7383
查看次数

Elasticsearch foselastica 存储库和 groupBy

你好我有一个问题..

我有我的 elastica 存储库

namespace XX\xxx;

use FOS\ElasticaBundle\Repository;

class TestRepository extends Repository
{
public function getExamples($argOne, $argTwo) {
    $query = new BoolQuery();

    $matchOne = new Match();
    $matchOne->setField('column_one', $argOne);
    $query->addMust($matchOne);

    $matchTwo = new Match();
    $matchOne->setField('column_two', $argTwo);
    $query->addMust($matchTwo);

    return $this->find($query);
  }
}
Run Code Online (Sandbox Code Playgroud)

和测绘

...
types:
   example:
      mappings:
         column_one:
              type: integer
         column_two:
              type: string
         column_three:
              type: date
Run Code Online (Sandbox Code Playgroud)

我的问题是..

我需要按第三列获取查询组。我不知道该怎么做。

我将不胜感激的信息..

symfony elasticsearch elastica foselasticabundle

5
推荐指数
1
解决办法
1111
查看次数

FosElasticaBundle动态指数?

我正在构建一个具有多个索引的多租户应用程序,每个租户一个索引。

只是想知道是否有任何工作允许动态更改索引名称?

php symfony elasticsearch foselasticabundle

5
推荐指数
0
解决办法
192
查看次数

FosElasticaBundle:一个索引中包含多种类型

我需要建立一个多实体搜索。

我不想每个T1,然后每个T2。

使用时fos:lastica:populate,出现错误:

拒绝将映射更新更新为[search_dev],因为最终映射将具有1种以上的类型:[t1,t2]

我的映射:

fos_elastica:
   clients:
       default:
           host: %elastic_host%
           port: %elastic_port%
   indexes:
       search:
           finder: ~
           client: default
           index_name: search_%kernel.environment%
           types:
               t1:
                   indexable_callback: 'getEnabled'
                   properties:
                       id:
                          type: integer
                       name: ~
                   persistence:
                       driver: orm
                       model: AppBundle\Entity\T1
                       finder: ~
                       listener:
                          logger: true
                       elastica_to_model_transformer:
                          ignore_missing: true
               t2:
                   indexable_callback: 'getEnabled'
                   properties:
                       id:
                          type: integer
                       name: ~
                   persistence:
                       driver: orm
                       model: AppBundle\Entity\T2
                       finder: ~
                       listener:
                          logger: true
                       elastica_to_model_transformer:
                          ignore_missing: true
Run Code Online (Sandbox Code Playgroud)

我的服务:

$search = $this->indexManager->getIndex('search')->createSearch();
$search->addType('t1');
$search->addType('t2');
$resultSet = $search->search($query);

$results = $this->modelTransformer->transform($resultSet->getResults());
Run Code Online (Sandbox Code Playgroud)

我错过了什么?我可以在1个索引中映射2种类型吗?

php symfony foselasticabundle

5
推荐指数
1
解决办法
1252
查看次数