The hlquery Ruby API is the official Ruby client for hlquery. It mirrors the practical endpoint coverage of the other hlquery clients while exposing Ruby-style method names and service objects.
It is intended for scripts, services, internal tools, and apps that want a small Ruby wrapper over hlquery's HTTP interface.
Use it when you want a cleaner Ruby interface than hand-written Net::HTTP calls, with consistent auth, params, parsed response handling, and coverage for collections, documents, search, and custom route access.
Local usage:
$LOAD_PATH.unshift(File.expand_path("lib", __dir__))
require "hlquery"Client initialization:
client = Hlquery::Client.new(ENV["HLQ_BASE_URL"] || ENV["HLQUERY_BASE_URL"] || "http://localhost:9200")$LOAD_PATH.unshift(File.expand_path("lib", __dir__))
require "hlquery"
client = Hlquery::Client.new("http://localhost:9200")
health = client.health
puts "status: #{health.body["status"] || "ok"}" if health.success?
collections = client.list_collections(0, 10)
puts collections.body.inspectclient = Hlquery::Client.new("http://localhost:9200", {
token: "your_token_here",
auth_method: "bearer"
})
client.set_auth_token("your_token_here", "bearer")
client.set_auth_token("your_api_key_here", "api-key")results = client.search("products", {
"q" => "waterproof jacket",
"limit" => 10
})If q is set and query_by is omitted, the client tries to infer query_by from the collection's searchable_fields.
We welcome contributions from the community! All contributions must be released under the BSD 3-Clause license.
- Check existing Ruby API issues or create new ones
- Contribute Ruby client changes to hlquery/ruby-api
- Contribute shared server/API changes to hlquery/hlquery
- Test and report bugs against the Ruby client
- Improve Ruby-specific documentation and examples
result = client.search_all(q: "research", limit: 20)
selected = client.search_all(body: { q: "research", collections: %w[universities science] })global_search remains available as an equivalent name. Results are globally merged and each hit includes document._collection.
The hlquery Ruby API is licensed under the BSD 3-Clause License.
