# elastic/elasticsearch-rails

Elasticsearch integrations for ActiveModel/Record and Ruby on Rails

Repository: https://github.com/elastic/elasticsearch-rails
Canonical: https://ross.abutalabs.com/products/elasticsearch-rails
Language: Ruby
License: Apache-2.0
License Family: permissive
Topics: ruby, rails, ruby-on-rails, elasticsearch, elastic, activerecord, activemodel
Last push: 2025-10-08T13:42:09+00:00

## Health v2 (maintenance only)
Score: 45/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 46, release rhythm 13, longevity 100
- inputs: {"age_days": 4681, "days_push": 329, "days_rel": 366, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3084, forks 797 (observed 2026-08-28T04:07:42.033161+00:00)

## What it is
Official Elasticsearch integrations for Ruby on Rails, provided as three gems: elasticsearch-model (ActiveModel/ActiveRecord/Mongoid search integration), elasticsearch-persistence (repository pattern persistence), and elasticsearch-rails (Rails conveniences like rake import tasks and instrumentation). It lets Rails models be indexed into and searched via Elasticsearch 8.x.

## Use cases
- add full-text search to Rails ActiveRecord models with Elasticsearch
- index and sync ActiveRecord records into Elasticsearch
- search results returned as ActiveRecord relations with pagination
- persist plain Ruby objects in Elasticsearch via repository pattern
- rake tasks to bulk import model data into Elasticsearch
- integrate Elasticsearch with Mongoid models

## When to choose
- you have a Ruby on Rails or Ruby app using ActiveRecord or Mongoid and want Elasticsearch-backed search
- you want model callbacks, mappings, and import tasks wired up automatically
- you want search results as enumerable records with Kaminari/WillPaginate pagination

## When to avoid
- your project is not Ruby/Rails
- you use OpenSearch or a non-Elasticsearch search engine
- you only need a raw Elasticsearch client without model integration (use elasticsearch-ruby instead)

## Facets
- artifact type: library
- maturity: active
- function: search-engine, orm, database-driver
- domain: web-development, databases, backend
- platform: ruby, jvm
- tags: elasticsearch, rails, activerecord, activemodel, ruby-gem, full-text-search, search

## Member repositories
- elastic/elasticsearch-rails (main) score 45

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:42.033161+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:27:40.930408+00:00, confidence not recorded.
  - readme: https://github.com/elastic/elasticsearch-rails (fetched 2026-08-28T04:07:42.033161+00:00, sha f58ce02c3783)
- Data as of 2026-08-30T08:39:29.467469+00:00.
