symfony - ONGR Elasticsearch Bundle AWS Connection Issue
问题描述
Hello Ther i try to connenct to ES indet that is located on AWS, but i still get he Error.
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "es.managers.default".
I installed the bundle using Conposer, as described on the Docs. then added a config part tom my config.ylm
ongr_elasticsearch:
managers:
default:
index:
index_name: contents
hosts:
- https://search-***.es.amazonaws.com:443
mappings:
- StatElasticBundle
i have a awsaccesskey and a awssecretkey, but i don't now where i have to put them, so i created a aws_connection section in the parameters.yml and try to load it
Then i try to establish a connection in my SymfonyBundle and created a class in my Bundle->DepandencyInjection folder to extend my bundle, this is where i get the error. Mayby someone of you struggled with the same error? Thanks for help.
Class StatElasticExtension extends Extension
{
const YAML_FILES = [
'parameters.yml',
'config.yml',
'services.yml'
];
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
foreach (self::YAML_FILES as $yml) {
$loader->load($yml);
}
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$serviceDefinition = $container->getDefinition('es.managers.default');
$awsConnections = $container->getParameter('aws_connections');
$elasticsearchClient = $this->getClient($awsConnections);
$serviceDefinition->replaceArgument(2, $elasticsearchClient);
}
解决方案
正确的服务名称是es.manager.default
.
推荐阅读
- python - Python中的print(f'和f'有什么区别?
- javascript - 提交后如何关闭表单模式?
- c - C 集合和指针错误 - 来自不兼容的指针类型的赋值
- selenium - 未捕获的 DOMException:无法在“CommandLineAPI”上执行“$x”:由于使用了特殊字符
- python - 不支持 Python Zipfile 压缩方法
- discord - Error when outputting an image inside an embed with canvas | Discord.js
- python - 如何解决 Python 中类方法的 NameError?
- spring-boot - SpringBoot OAuth2 error "Full authentication is required to access this resource"
- pytest - How does Pytest figure out that the monkeypatch fixture is for monkeypatching?
- c# - Discord.Net 使用 Bots 头像作为 IconURL/AvatarURL