【问题标题】:Errors running 'composer update' with ONGR ES-Bundle使用 ONGR ES-Bundle 运行“composer update”时出错
【发布时间】:2019-10-23 03:19:41
【问题描述】:

我在我的 Symfony 项目中运行 ONGR ElasticSearchBundle(以前我只使用 ES-PHP 客户端)。我将使用公司名称和描述搜索现有索引,索引名称是公司。它看起来是这样的:

"mappings": {
        "_doc": {
            "properties": {
                "id": {"type": "long"},
                "entityid": {"type": "long"},
                "entityname": {"type": "keyword"},
                "name": {"type": "text"},
                "street": {"type": "text"},
                "city": {"type": "text"},
                "zip": {"type": "long"},
                "ziptext": {"type": "keyword"},
                "regionisocode": {"type": "keyword"},
                "desc": {"type": "text"},
                "branch": {"type": "text"},
                "branchid": {"type": "long"},
                "foundingyear": {"type": "date"}

            }
        }
    }

文档类看起来是这样的:

/**
 * Company
 *
 * @ES\Document()
 */
class Company
{
    /**
     * @var string
     *
     * @ES\Property(type="long", options={"index"="not_analyzed"})
     */
    private $id;

    /**
     * @var string
     *
     * @ES\Property(type="long", options={"index"="not_analyzed"})
     */
    private $entityid;

    /**
     * @var string
     *
     * @ES\Property(type="keyword", options={"index"="not_analyzed"})
     */
    private $entityname;
...

当我将注释更改为:

/**
 * Company
 *
 * @ES\Document(type="_doc")
 */

然后搜索运行正常,但我无法执行任何作曲家命令,因为我收到此错误: [RuntimeException]An error occurred when executing the "'cache:clear --no-warmup'" command:[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundExcepton] The service "company_search_service" has a dependency on a non-existent service "es.manager.default.company". 我在 GitHub 上的 Bundle 中发现了一个问题,但它已经过去了四年多,并且已经关闭。

没有@ES\Document(type="_doc") 注释我无法访问索引。也许有人有建议? 提前谢谢你

我正在使用 Symfony 2.8 和 ONGR/Elastic Bundle 5.2.4

【问题讨论】:

    标签: elasticsearch ongr


    【解决方案1】:

    我不知道它是否仍然相关,但失败的服务是您文档的存储库服务。它失败了,因为您可能在某个地方需要它。 存储库服务名称是通过将管理器服务名称 (es.manager.default) 附加到类型名称(默认情况下为小写的文档类名称,在您的情况下为 - company)动态生成的,因此 - es.manager.default.company。当您添加不同的类型名称(在这种情况下为_doc)时,您的存储库名称将更改为es.manager.default._doc。 您可以检查这一点并更改您的服务要求,但老实说,我不鼓励使用 _doc 作为类型名称。

    【讨论】:

      猜你喜欢
      • 2016-01-15
      • 2023-02-07
      • 2018-09-01
      • 2018-08-08
      • 1970-01-01
      • 2013-08-14
      • 2020-07-03
      • 2015-03-12
      • 1970-01-01
      相关资源
      最近更新 更多