AWS API网关指向Elastic:访问密钥PHP

问题描述 投票:0回答:1

我们有一个设置,在前面我们有AWS API网关,它在内部指向Elastic应用程序。 API网关使用访问密钥进行保护。

我正在寻找一种使用Elastic php库发送API密钥的方法。到目前为止看起来Elastic PHP reference但没有找到任何解决方案。

我知道我们必须将标头设置为x-api-key:请求中的值,但是没有找到有关如何使用Elastic PHP库设置它的任何信息。

注意:标题x-api-key已在邮递员中成功测试。

php amazon-web-services elasticsearch
1个回答
0
投票

找到解决方案:感谢Zachary Tong的弹性

$client_builder = ClientBuilder::create();
$client_builder->setConnectionParams([
  'headers' => [
    'x-api-key' => 'headerValue'
  ]
]);
© www.soinside.com 2019 - 2024. All rights reserved.