Search by

kinetis / search-opensearch

aln-1

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

Package info

github.com/kinetis-dev/search-opensearch

pkg:composer/kinetis/search-opensearch

Statistics

Installs: 12

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.1 2026-09-13 11:01 UTC

This package is auto-updated.

Last update: 2026-09-13 11:15:58 UTC


README

Kinetis

kinetis/search-opensearch
Non-blocking OpenSearch 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 OpenSearch\Client (from opensearch-project/opensearch-php) through OpenSearch's own TransportFactory/HttpTransport construction path, over kinetis/search's Revolt-native HTTP transport instead of the default blocking one. 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. The status, headers and body are complete before the adapter returns, so a transport failure mid-body is a SearchNetworkException rather than something the official client meets while reading a stream. Every status OpenSearch answers with stays the official client's to map.

use Kinetis\SearchOpenSearch\OpenSearchClientFactory;

$client = OpenSearchClientFactory::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 OpenSearch\Client, built by OpenSearchClientFactory::fromConfig() when SEARCH_OPENSEARCH_HOST is set, and one for kinetis/search's engine-neutral SearchClient over it. Unset means the package binds nothing. The client is built during registration and opens no connection, so unusable configuration fails at boot rather than on the first search; an application's own bootstrap.php runs afterwards and can replace either binding.

Nothing else. Named connections stay explicit application wiring.

Configuration

SEARCH_OPENSEARCH_HOST=https://localhost:9200

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

Key Default Purpose
SEARCH_OPENSEARCH_HOST (required) One http(s)://host[:port] origin.
SEARCH_OPENSEARCH_PLAINTEXT false Accept an http origin.
SEARCH_OPENSEARCH_TIMEOUT 30 Seconds per request — idle and total. Must be positive.
SEARCH_OPENSEARCH_MAX_RESPONSE_BYTES 8388608 Largest response body accepted. Must be positive.
SEARCH_OPENSEARCH_USERNAME Basic-auth user.
SEARCH_OPENSEARCH_PASSWORD Basic-auth password.
SEARCH_OPENSEARCH_VERIFY_PEER true Verify the server certificate — false accepts a self-signed one on a security-enabled cluster.

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

SEARCH_OPENSEARCH_HOST is one origin and one node. Userinfo, a path, a query and a fragment are all refused: the official client's endpoints are root-relative, so a base path would be dropped rather than honoured, and credentials belong in the username and password keys. There is no multi-node selector or failover — put a load balancer in front of a multi-node cluster and point this at it.

An unusable host, an http origin without the opt-in, and a non-positive timeout or response bound each raise a SearchConfigurationException naming the key. A request that never produces a complete response raises a SearchNetworkException carrying it. Both belong to kinetis/search, along with the SearchRequestException its engine-neutral client reports an error status as.

fromConfig()'s optional $transportDecorator parameter wraps the fully-configured PSR-18 adapter right before TransportFactory gets it — the seam kinetis/telemetry's TracingSearchTransport plugs into, without duplicating the transport's own config-reading logic.

Installation

composer require kinetis/search-opensearch

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

License

MIT — see LICENSE.