Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 912 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 912 Bytes

AwsEsConnection

Kind of connector to use AWS Elasticsearch Service with elastic/elasticsearch-php client

Build Status

Installation

composer require wizacha/aws-signature-middleware

Usage

Exemple with elasticsearch client

<?php
$credentials = new \Aws\Credentials\Credentials('id', 'secret');
$signature = new \Aws\Signature\SignatureV4('es', 'eu-west-1');

$middleware = new \Wizacha\Middleware\AwsSignatureMiddleware($credentials, $signature);
$defaultHandler = \Elasticsearch\ClientBuilder::defaultHandler();
$awsHandler = $middleware($defaultHandler);

$clientBuilder =  \Elasticsearch\ClientBuilder::create();

$clientBuilder
    ->setHandler($awsHandler)
    ->setHosts(['endpoint.eu-west-1.es.amazonaws.com:80'])
;
$client = $clientBuilder->build();