Search by

kinetis / search-elasticsearch

aln-1

Fiber-native non-blocking Elasticsearch client construction for Kinetis, on kinetis/search's Revolt-backed HTTP transport.

Package info

github.com/kinetis-dev/search-elasticsearch

pkg:composer/kinetis/search-elasticsearch

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-09-08 22:28 UTC

This package is auto-updated.

Last update: 2026-09-08 22:40:50 UTC


README

Kinetis

kinetis/search-elasticsearch
Non-blocking Elasticsearch client construction for Kinetis

Packagist Version Packagist Downloads PHP Version License CI

Part of Kinetis, a non-blocking PHP framework for API-first applications, developed in the kinetis-dev/kinetis monorepo.

Builds a real Elastic\Elasticsearch\Client (from elasticsearch/elasticsearch) through Elasticsearch's own ClientBuilder, over kinetis/search's Revolt-native HTTP transport instead of the blocking cURL client the builder would otherwise discover. The returned object is the real, un-wrapped client — nothing Kinetis-specific sits on top of it.

Each call is one wire attempt against one origin, bounded by one deadline and one response size, following no redirect and making no retry: Elastic\Transport\Transport re-sends on a PSR-18 network failure, which would replay an index or bulk whose dispatch outcome is unknown, so retries are pinned to zero. Every status Elasticsearch answers with stays the official client's to map.

use Kinetis\SearchElasticsearch\ElasticsearchClientFactory;

$client = ElasticsearchClientFactory::fromConfig($config);

$client->index(['index' => 'articles', 'id' => '1', 'body' => ['title' => 'Kinetis']]);
$results = $client->search(['index' => 'articles', 'body' => ['query' => ['match' => ['title' => 'Kinetis']]]]);

Provides

Installing this package auto-registers, via extra.kinetis:

  • A container binding for Elastic\Elasticsearch\Client when SEARCH_ELASTICSEARCH_HOST is set, and one for kinetis/search's engine-neutral SearchClient over it. Unset means the package binds nothing. Neither is shared: Elastic\Transport\Transport keeps the last request and response it saw, so one client per worker would hold one request's documents until the next search displaced them. The transport that owns the connection pool is built once during registration — opening no connection, so unusable configuration fails at boot rather than on the first search — and each resolution gets its own client over it. An application's own bootstrap.php runs afterwards and can replace either binding.

Nothing else. Named connections stay explicit application wiring.

Configuration

SEARCH_ELASTICSEARCH_HOST=https://localhost:9200

The host, deadline, response bound, Basic credentials and TLS switch are kinetis/search's, spelled with this engine's prefix. What this package adds:

Key Default Purpose
SEARCH_ELASTICSEARCH_API_KEY An API key — the encoded value the cluster hands out, or the secret alongside the id below. Travels as an Authorization: ApiKey header, never in the URL.
SEARCH_ELASTICSEARCH_API_KEY_ID The key's id, when it is held separately from its secret.

An API key and SEARCH_ELASTICSEARCH_USERNAME together are refused while the client is built: they are two credentials for one request.

Every key is scoped — SEARCH_ELASTICSEARCH_HOST + logsSEARCH_LOGS_ELASTICSEARCH_HOST. Full reference: kinetis.dev/docs/search.html.

Matching the client to your cluster

elasticsearch/elasticsearch ^8.19 || ^9.0 is accepted, and the major must match the cluster's: a 9.x client sends compatible-with=9, which an 8.x cluster rejects. Composer resolves to the newest allowed release, so an Elasticsearch 8 cluster needs the constraint pinned in your own application:

composer require elasticsearch/elasticsearch:^8.19

Installation

composer require kinetis/search-elasticsearch

Requires PHP 8.4+, kinetis/framework, and kinetis/search. Full documentation: kinetis.dev/docs/search-elasticsearch.html.

License

MIT — see LICENSE.