Repolode
ankane

ankane/searchkick

Ruby on Rails search library that adds intelligent full-text search to Active Record and Mongoid models via Elasticsearch or OpenSearch.

Stars
6,720
Forks
761
Open issues
10
Last commit
11 days ago

What is it?

Searchkick is a Ruby gem that connects Active Record and Mongoid models to Elasticsearch or OpenSearch, letting developers add full-text search by declaring a single line in a model. It handles stemming, special characters, extra whitespace, misspellings, and custom synonyms, so a query for "tomatoes" can match "tomato" and "zuchini" can match "zucchini".

Queries use a chainable, SQL-like interface covering where filters, ordering, pagination, boosting, aggregations, highlighting, autocomplete, suggestions, and geospatial searches. Indexing can run inline, asynchronously, through a Redis-backed queue, or manually, and reindexing can be done in parallel without downtime.

Searchkick supports Elasticsearch 8 and 9 and OpenSearch 2 and 3. Searches can be personalized per user and tuned with conversion data from Searchjoy.

Key features

  • 01Stemming, misspelling tolerance, and custom synonyms out of the box
  • 02SQL-like query chaining with where, order, limit, and offset
  • 03Autocomplete, "did you mean" suggestions, and highlighting
  • 04Aggregations, boosting by field, recency, distance, and per-user results
  • 05Geospatial and geo shape search
  • 06Reindexing without downtime, with async, queued, and parallel modes

Use cases

  • Adding product or content search to a Rails e-commerce or catalog application
  • Building autocomplete for a large model with Active Record or Mongoid
  • Providing faceted filtering with aggregations on search results
  • Running location-based search for restaurants or stores

Quick start

  1. 1

    Install and start OpenSearch via Homebrew

    brew install opensearch && brew services start opensearch
  2. 2

    Add searchkick and an Elasticsearch or OpenSearch client to your Gemfile

    gem "searchkick"
  3. 3

    Add searchkick to a model and index its data

    Product.reindex

Things to know

  • Requires a running Elasticsearch or OpenSearch server.
  • Elasticsearch 7 and OpenSearch 1 need the older version 5.5.2.

Topics

FAQ

What is searchkick?
Ruby on Rails search library that adds intelligent full-text search to Active Record and Mongoid models via Elasticsearch or OpenSearch. Searchkick is a Ruby gem that connects Active Record and Mongoid models to Elasticsearch or OpenSearch, letting developers add full-text search by declaring a single line in a model. It handles stemming, special characters, extra whitespace, misspellings, and custom synonyms, so a query for "tomatoes" can match "tomato" and "zuchini" can match "zucchini".
Is searchkick free to use? What license does it have?
searchkick is open source under the MIT license. Check the license terms before using it in commercial products.
Is searchkick still maintained?
Actively maintained. The last commit to searchkick was on Oct 27, 2026.
What can I use searchkick for?
Adding product or content search to a Rails e-commerce or catalog application Building autocomplete for a large model with Active Record or Mongoid Providing faceted filtering with aggregations on search results Running location-based search for restaurants or stores
How do I install searchkick?
Install and start OpenSearch via Homebrew: brew install opensearch && brew services start opensearch Add searchkick and an Elasticsearch or OpenSearch client to your Gemfile: gem "searchkick" Add searchkick to a model and index its data: Product.reindex
Where can I get searchkick?
The source code and installation instructions are on GitHub: https://github.com/ankane/searchkick

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects

Agnostic pagination library for plain Ruby that supports offset, keyset, search and calendar paginators across Rails, Sinatra and other frameworks.

5K446RubyMITWell maintainedUpdated 2 days ago