Searchkick
Intelligent search for Ruby on Rails using Elasticsearch or OpenSearch — provides full-text search with relevance ranking, typo tolerance, autocomplete, and faceted filtering with a clean ActiveRecord-like API. Searchkick features: `searchkick` macro on models, `Agent.search('query')` for full-text search, `Agent.search('query', fields: [:name, :description], boost_by: [:usage_count])` for weighted search, `Agent.search('q', aggs: [:category, :status])` for facets, `Agent.search('ag', match: :word_start)` for autocomplete. Handles Elasticsearch index management (reindex, zero-downtime reindex), search analytics (track clicks and conversions), and personalization. Much simpler than raw Elasticsearch client for Rails.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Agent search indexes may contain PII — searchkick_data method controls what gets indexed; never index passwords, API keys, or sensitive agent credentials. Elasticsearch cluster should require auth in production (ELASTICSEARCH_URL with credentials). Consider field-level security for multi-tenant agent search indexes.
⚡ Reliability
Best When
Your Rails agent platform needs production-grade full-text search with relevance ranking, typo tolerance, facets, and autocomplete — Searchkick delivers Elasticsearch power with ActiveRecord simplicity.
Avoid When
You only need simple SQL search, you don't want to maintain Elasticsearch infrastructure, or your search requirements are better served by Algolia or Typesense.
Use Cases
- • Full-text agent catalog search — Agent.search(params[:q], fields: [:name, :description, :capabilities], operator: 'or') provides ranked full-text search across agent content with typo tolerance for agent marketplace search
- • Agent autocomplete suggestions — Agent.search(params[:q], match: :word_start, limit: 5, load: false) returns fast autocomplete suggestions without loading ActiveRecord objects for agent search input component
- • Faceted agent filtering — Agent.search('assistant', aggs: [:category, :language, :pricing_model], where: { active: true }) returns both results and category counts for agent catalog facet sidebar
- • Zero-downtime agent index updates — Agent.reindex runs async Searchkick background reindex without downtime; adding new searchkick fields doesn't break live agent search during deployment
- • Agent search analytics — Searchkick.search_model.track({ user_id: current_user.id, searched_id: result.id }) tracks agent search impressions and clicks for relevance tuning
Not For
- • Simple SQL LIKE queries — if agent search only needs case-insensitive name matching, PostgreSQL pg_trgm or Ransack contains predicate avoids Elasticsearch infrastructure overhead
- • Non-Elasticsearch backends — Searchkick requires Elasticsearch or OpenSearch; for Algolia-backed agent search, use algoliasearch-rails; for Typesense, use typesense-rails
- • Geospatial search — while Searchkick supports geo_point fields, complex geographic agent search (radius queries, routing) is better served by raw Elasticsearch geo queries or PostGIS
Interface
Authentication
Searchkick connects to Elasticsearch/OpenSearch via ELASTICSEARCH_URL env var. Production clusters require auth (API key or basic auth in URL). Use Elastic Cloud credentials via ENV for agent production search.
Pricing
Searchkick gem is MIT licensed, maintained by Andrew Kane. Elasticsearch hosting (Elastic Cloud, AWS OpenSearch) has separate costs.
Agent Metadata
Known Gotchas
- ⚠ searchkick_index must be rebuilt after schema changes — adding new fields to searchkick_data or changing field types requires Agent.reindex; existing index doesn't automatically pick up new agent document fields; search returns nil for new fields until reindex completes
- ⚠ where: conditions use Elasticsearch filter, not SQL — Agent.search('assistant', where: { user_id: current_user.id }) is NOT a SQL WHERE; it's an Elasticsearch term filter on indexed data; agent model must include user_id in searchkick_data or filter silently returns empty results
- ⚠ load: false avoids N+1 DB queries for autocomplete — Agent.search(q, load: false) returns Searchkick::Results with indexed data but no ActiveRecord objects; accessing attributes not in searchkick_data returns nil; for agent search results needing only name+id, load: false is 10x faster than default load: true
- ⚠ Callbacks cause ES write on every model save — searchkick enables after_commit callbacks by default; every agent model update triggers Elasticsearch document update adding ~50-100ms latency; for high-frequency agent updates, use callbacks: :async or callbacks: false with scheduled batch reindex
- ⚠ reindex in production needs zero-downtime mode — Agent.reindex uses alias-based zero-downtime reindex by default; if Elasticsearch alias doesn't exist (first run), reindex creates and aliases correctly; on version upgrades requiring mapping changes, always test reindex on staging before production agent search index migration
- ⚠ Multi-word query behavior differs by match type — Agent.search('fast agent') with default match: :word returns agents matching 'fast' OR 'agent'; match: :phrase requires exact phrase 'fast agent'; match: :text uses full-text analysis; choose carefully based on agent search UX requirements and test with real queries
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for Searchkick.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-07.