manticore-client
A Ruby client for Manticore Search, generated from the OpenAPI specification.
API Version: 5.0.0 • Gem Version: 1.0.0 • Generator: OpenAPI Generator v7.13.0
Table of Contents
- Installation
- Usage
- Configuration
- Documentation
- Development
- Contributing
- License
Installation
From RubyGems
Add to your Gemfile:
gem 'manticore-client', '~> 1.0'Then run:
bundle installOr install directly:
gem install manticore-clientFrom GitHub
# Gemfile
gem 'manticore-client', git: 'https://github.com/numbata/manticore-client.git'Usage
require 'manticore-client'
# Optionally configure credentials or host
Manticore::Client.configure do |config|
config.host = 'http://127.0.0.1:9308'
config.username = 'user'
config.password = 'pass'
end
# Create an API client instance
client = Manticore::Client::IndexApi.new
# Example: bulk operations
body = <<~NDJSON
{ "insert": { "index": "table_name", "id": 3, "doc": { "title": "New movie", "rating": 8.5 } } }
{ "delete": { "index": "table_name", "id": 2 } }
NDJSON
begin
response = client.bulk(body)
puts response
rescue Manticore::Client::ApiError => e
warn "API error: #{e.message} (status=#{e.code})"
endConfiguration
You can override default settings by calling configure. Available options:
| Option | Default | Description |
|---|---|---|
host |
http://127.0.0.1:9308 |
Base URL for the Manticore Search API |
username |
nil | HTTP Basic auth username |
password |
nil | HTTP Basic auth password |
timeout |
60 |
HTTP request timeout in seconds |
Documentation
Generated API and model documentation is available under the docs/ directory:
Or browse online at GitHub Pages.
Development
-
Fork and clone this repository
-
Install dependencies:
bundle install
-
Run tests:
bundle exec rspec -
Regenerate client after schema changes:
openapi-generator-cli generate \ -i https://raw.githubusercontent.com/manticoresoftware/openapi/master/manticore.yml \ -g ruby \ -o ./ \ --skip-overwrite \ --additional-properties=\ library=faraday,\ gemName=manticore/client,\ moduleName=Manticore::Client,\ useAutoload=true
Contributing
Contributions are welcome! Please open issues and pull requests against main. Ensure your code passes lint and tests before submitting.
License
This project is licensed under the MIT License. See the LICENSE file for details.