ebatis: An Elasticsearch ORM Framework for Simplified Query Building
ebatis is an Elasticsearch ORM framework that simplifies query building by providing a MyBatis-like interface, eliminating the need for manual DSL construction and enabling seamless version upgrades.
ebatis is an Elasticsearch ORM framework designed to simplify query building and eliminate the need for manual DSL construction. It was developed by Full Truck Alliance to address pain points encountered when using Elasticsearch clients, particularly around version compatibility and complex query building.
The framework is based on Java High Level REST Client and follows a MyBatis-like approach where developers only need to define interfaces to access Elasticsearch. This isolates business logic from direct Elasticsearch API access, significantly improving development efficiency.
Key features include:
- Version compatibility: Automatically handles differences between Elasticsearch versions, allowing seamless upgrades by simply updating the ebatis version
- ORM-style query building: Uses POJO objects to construct queries instead of manual DSL building
- Support for various request types: Search, MultiSearch, Index, Get, Delete, Update, Bulk, MultiGet, UpdateByQuery, DeleteByQuery, SearchScroll, ClearScroll, and Aggregation
- Asynchronous support: Methods can return CompletableFuture for non-blocking operations
- Interceptor support: Allows custom interceptors for request/response processing
- Spring integration: Provides easy integration with Spring framework
The framework has been running stably in production at Full Truck Alliance for nearly a year, handling billions of search requests daily. It offers significant advantages over native Java High Level REST Client and Spring Data Elasticsearch, particularly in complex search scenarios where conditions frequently change.
ebatis uses a version naming convention where the first three digits represent the Elasticsearch version it supports, and the fourth digit represents the ebatis iteration on that version (e.g., 7.5.1.3.RELEASE).
The framework provides comprehensive documentation and is available on GitHub for those interested in contributing or using it in their projects.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
