Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webgriffe/amp-elasticsearch
A non-blocking ElasticSearch client for PHP based on Amp.
https://github.com/webgriffe/amp-elasticsearch
amphp elasticsearch php
Last synced: 6 days ago
JSON representation
A non-blocking ElasticSearch client for PHP based on Amp.
- Host: GitHub
- URL: https://github.com/webgriffe/amp-elasticsearch
- Owner: webgriffe
- License: mit
- Created: 2019-05-19T16:42:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T16:14:56.000Z (3 months ago)
- Last Synced: 2024-11-14T22:36:53.644Z (3 months ago)
- Topics: amphp, elasticsearch, php
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Amp ElasticSearch Client
`webgriffe/amp-elasticsearch` is a non-blocking ElasticSearch client for use with the [`amp`](https://github.com/amphp/amp)
concurrency framework.[![Build](https://github.com/webgriffe/amp-elasticsearch/actions/workflows/build.yml/badge.svg)](https://github.com/webgriffe/amp-elasticsearch/actions/workflows/build.yml)
**Required PHP Version**
- PHP 7.4
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3**Installation**
```bash
composer require webgriffe/amp-elasticsearch
```**Usage**
Just create a client instance and call its public methods which returns promises:
```php
Loop::run(function () {
$client = new Webgriffe\AmpElasticsearch\Client('http://my.elasticsearch.test:9200');
yield $this->client->createIndex('myindex');
$response = yield $this->client->indexDocument('myindex', '', ['testField' => 'abc']);
echo $response['result']; // 'created'
});
```See other usage examples in the [`tests/Integration/ClientTest.php`](./tests/Integration/ClientTest.php).
All client methods return an array representation of the ElasticSearch REST API responses in case of sucess or an `Webgriffe\AmpElasticsearch\Error` in case of error.
## Security
If you discover any security related issues, please email [`[email protected]`](mailto:[email protected]) instead of using the issue tracker.
## License
The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.