Download the PHP package codeduck/elasticsearch without Composer
On this page you can find all versions of the php package codeduck/elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package elasticsearch
Minimalistic elasticsearch client
Born out of frustration about the dependency hell of the available client packages. I didn't need a library with all the features, as a result this package was born. It provides the bare minimum to index, delete and query documents.
This library is compatible with elasticsearch 6.x and 7.x and has no dependencies on the official elasticsearch client packages.
All issues should go to the issue tracker from github.
Features
- Adding a document to an elasticsearch index
- Delete a document from an elasticsearch index
- Send multiple adding and delete actions as a bulk action
- Run a query on an elasticsearch index
Usage
use CodeDuck\Elasticsearch\Client;
use CodeDuck\Elasticsearch\SimpleClient;
use Symfony\Component\HttpClient\HttpClient;
$client = new SimpleClient(
new Client(HttpClient::create(), 'http://127.0.0.1:9200'),
'my-index', '_doc'
);
$client->begin();
$client->add('ID-123', ['name' => 'foo', 'foo' => 12345]);
$client->add('ID-234', ['name' => 'bar', 'foo' => 12345]);
$client->commit();
$result = $client->query(['query' => ['term' => ['name' => 'bar']]]);
foreach ($result->getDocuments() as $document) {
echo json_encode($document->getSource(), JSON_THROW_ON_ERROR) . PHP_EOL;
}
$client->begin();
$client->delete('ID-123');
$client->delete('ID-234');
$client->commit();
More detailed examples can be found here: simple client.
TODO
- Complete documentation
- Actions should return the response from elasticsearch, especially for bulk actions
- Investigating options for authentication besides username and password in the server url (necessary?)
All versions of elasticsearch with dependencies
PHP Build Version
Package Version
The package codeduck/elasticsearch contains the following files
Loading the files please wait ....