Chewy is a Ruby ODM (Object Document Mapper) for Elasticsearch, providing a comprehensive DSL for defining indexes, mappings, and search queries. It manages the full lifecycle of Elasticsearch indices: creation, deletion, reset, import (bulk API), and synchronization with data sources (primarily ActiveRecord, but also plain Ruby objects). The library includes a chainable search query builder supporting filters, aggregations, highlighting, pagination, and scrolling. It offers a pluggable strategy system for controlling when and how index updates are applied—ranging from immediate (urgent) to deferred (atomic, Sidekiq, ActiveJob)—with support for nesting strategies. Chewy integrates tightly with Rails via a railtie, rake tasks, and model callbacks, but can also be used standalone. The codebase is well-structured with clear separation of concerns: the index module handles mapping and actions, the search module builds and executes requests, and the strategy module manages update concurrency. Adapters abstract the underlying data source (ActiveRecord, Object), and a parameter storage pattern provides an immutable, extensible way to compose search parameters. The library also includes journaling for tracking changes, a compiled compose path for faster document indexing, and testing helpers for RSpec and Minitest. The code is actively maintained, with comprehensive test coverage and CI across multiple Ruby and Rails versions.
es-mode is an Emacs major mode for editing and executing Elasticsearch queries. It provides syntax highlighting, indentation, and keybindings for interacting with Elasticsearch clusters directly from Emacs buffers. The package includes features such as executing requests with C-c C-c, navigating between requests, copying requests as curl commands, an Elasticsearch Command Center for cluster monitoring, org-babel support for embedding queries in org-mode documents, and an interactive ESQL mode for Elasticsearch's ES|QL language. The architecture follows standard Emacs package conventions with several modular components: es-mode.el provides the core editing functionality, es-cc.el implements a monitoring dashboard, es-copyas.el handles request copying, es-esql.el offers an interactive ESQL interface, and ob-elasticsearch.el enables org-babel integration. The mode communicates with Elasticsearch using HTTP requests via the request library, displaying results in separate buffers with syntax highlighting and optional jq processing. Key strengths include thoughtful integration with Emacs workflows (company-mode completion, proper indentation, hook systems), robust error handling for network requests, and useful features like variable substitution in org-babel blocks and historical metric visualization in the command center. The code demonstrates solid Emacs Lisp craftsmanship with appropriate use of buffers, hooks, and asynchronous operations.