Skip to main content

API Clients Overview

hlquery keeps client libraries and examples for C++, Go, Java, Node.js, Perl, PHP, Python, Ruby, Rust, and TypeScript. These clients follow the same HTTP route contract where practical, so request and response behavior stays consistent across languages.

Available Clients

Common Features

  • Consistent API design: collections, documents, search, SQL, aliases, synonyms, stopwords, overrides, and system calls use similar shapes where supported
  • Authentication support: bearer token and X-API-Key flows
  • Validation: client-side parameter checks before sending requests in the fuller clients
  • Error handling: structured response wrappers and exception types
  • Raw requests: most maintained clients expose a lower-level request helper for new routes and module APIs
  • Operational APIs: maintained clients expose cache, active configuration-file, metrics-history, and debug-counter inspection where the server supports them
  • Search presets: all bundled clients expose list/get/create/update/delete helpers for /presets

Quick Comparison

ClientLocationNotes
C++etc/api/cppNative client headers, source, and examples
Goetc/api/goGo module with collection, document, search, SQL, and system helpers
Javaetc/api/javaJava client resources and tests
Node.jsetc/api/nodeAsync JavaScript client, optional PDF parser, route conformance tests
Perletc/api/perlService objects and parsed Hlquery::Response values
PHPetc/api/phpcURL-backed client with service classes
Pythonetc/api/pythonStandard-library client, optional PDF parser
Rubyetc/api/rubyRuby client and examples
Rustetc/api/rustAsync Rust client using Tokio
TypeScriptetc/api/typescriptTyped client source and generated dist output

Installation

Use the language-specific README for exact installation commands. Some clients are package-ready, while others are local source distributions in this repository.

Basic Usage

const client = new Client('http://localhost:9200');
const health = await client.health();
client = Client('http://localhost:9200')
health = client.health()
$client = new Client('http://localhost:9200');
$health = $client->health();

Search Across Collections

All maintained clients support /search, which produces one merged and globally paginated result set. Omit collections for every accessible collection, or provide a collection list to restrict the merge. Each hit includes document._collection.

ClientAll-collection helper
C++searchAll (globalSearch remains supported)
GoSearchAll / SearchAllGET (Global / GlobalGET)
JavasearchAll (globalSearch)
Node.jssearchAll (globalSearch)
PerlSearchAll / search_all (GlobalSearch)
PHPsearchAll (globalSearch)
Pythonsearch_all (global_search)
Rubysearch_all / searchAll (global_search)
Rustsearch_all (global_search)
TypeScriptsearchAll (globalSearch)
const results = await client.searchAll({
q: 'research',
collections: 'universities,science',
limit: 20,
offset: 0
});

See Global Search for GET/POST collection-list shapes, pagination guarantees, response metadata, distributed behavior, and limits.

Search Presets and Diagnostics

Preset names are URL-encoded by each client. Use the language's presets service (or the corresponding direct Java methods) to manage reusable search parameter objects. System services also provide wrappers for GET /cache, GET /config-files, GET /metrics/history, and GET /debug/counters where applicable.

Testing

Test coverage is split between shared endpoint tests and client-specific smoke or conformance tests:

  • Shared endpoint tests live in etc/api/tests
  • Client-specific tests live under each client directory where available
  • Node.js includes a route conformance test against the current server route contract

Next Steps

  • Start with API Overview for route behavior.
  • Use the client pages in this section for language-specific setup and examples.
  • Check etc/api/README.md in the repository for the full client directory map.