我在我的 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")
*/
然后搜索运行正常,但我无法执行任何作曲家命令,因为我收到此错误:
我在GitHub 上[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".
的 Bundle 中发现了一个问题,但它已经过去了四年多,并且已经关闭。
没有@ES\Document(type="_doc")
注释我无法访问索引。也许有人有建议?先感谢您
我正在使用 Symfony 2.8 和 ONGR/Elastic Bundle 5.2.4