dromara/easy-es

A foolproof Elasticsearch ORM framework that is easy to use, requires minimal coding, and is highly expandable...

Java

1,586

77 commits

updated May 10, 2026

See the code

README

East-Es-Logo

Born To Simplify Development

maven code style

What is Easy-Es?

Easy-Es is a powerfully enhanced toolkit of RestHighLevelClient for simplify development. This toolkit provides some efficient, useful, out-of-the-box features for ElasticSearch. By using Easy-Es, you can use MySQL syntax to complete Es queries. Use it can effectively save your development time.

Official website

easy-es website https://en.easy-es.cn/

easy-es gitee https://gitee.com/dromara/easy-es

easy-es github https://github.com/dromara/easy-es

dromara website https://dromara.org/

dromara gitee homepage https://gitee.com/dromara/

Features

  • Automatically create and update indexes, automatically migrate data, and process zero downtime
  • Auto configuration on startup
  • Out-of-the-box interfaces for operate es
  • Powerful and flexible where condition wrapper
  • Lambda-style API
  • Automatic paging operation
  • Support high-level syntax such as highlighting and weighting and Geo etc
  • ...

Compare

Demand: Query all documents with title equals "Hi" and author equals "Guy"


// Use Easy-Es to complete the query with only 1 lines of code
List<Document> documents = documentMapper.selectList(EsWrappers.lambdaQuery(Document.class).eq(Document::getTitle, "Hi").eq(Document::getCreator, "Guy"));
// Query with RestHighLevelClient requires 11 lines of code, not including parsing JSON code
String indexName = "document";
        SearchRequest searchRequest = new SearchRequest(indexName);
        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
        TermQueryBuilder titleTerm = QueryBuilders.termQuery("title", "Hi");
        TermsQueryBuilder creatorTerm = QueryBuilders.termsQuery("creator", "Guy");
        boolQueryBuilder.must(titleTerm);
        boolQueryBuilder.must(creatorTerm);
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(boolQueryBuilder);
        searchRequest.source(searchSourceBuilder);
        try {
        SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
        // Then parse the DocumentList from searchResponse in various ways, omitting these codes...
        } catch (IOException e) {
        e.printStackTrace();
        }

The above is just a simple query demonstration. The more complex the actual query scene, the better the effect, which can save 3-5 times the amount of code on average.

Getting started

  • Latest Version: Maven Central

  • Add Easy-Es dependency

    • Maven:
      <dependency>
        <groupId>org.dromara.easy-es</groupId>
        <artifactId>easy-es-boot-starter</artifactId>
        <version>Latest Version</version>
      </dependency>
      
    • Gradle
      compile group: 'org.dromara.easy-es', name: 'easy-es-boot-starter', version: 'Latest Version'
      
  • Add mapper file extends BaseEsMapper interface

    public interface DocumentMapper extends BaseMapper<User> {
    }
    
  • Use it

    LambdaEsQueryWrapper<Document> wrapper = new LambdaEsQueryWrapper<>();
    wrapper.eq(Document::getTitle,"Hello World")
           .eq(Document::getCreator,"Guy");
    List<Document> documentList = documentMapper.selectList();
    
    

    Easy-Es will execute the following Query:

    {"query":{"bool":{"must":[{"term":{"title":{"value":"Hello World","boost":1.0}}},{"term":{"creator":{"value":"Guy","boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}}}
    

    The syntax of this query in MySQL is:

     SELECT * FROM document WHERE title = 'Hello World' AND creator = 'Guy'
    

This showcase is just a small part of Easy-Es features. If you want to learn more, please refer to the documentation.

Architecture

Architecture

MySQL Easy-Es and Es syntax comparison table

MySQLEasy-EsEs-DSL/Es java api
andandmust
ororshould
=eqterm
!=neboolQueryBuilder.mustNot(queryBuilder)
>gtQueryBuilders.rangeQuery('es field').gt()
>=ge.rangeQuery('es field').gte()
<lt.rangeQuery('es field').lt()
<=le.rangeQuery('es field').lte()
like '%field%'likeQueryBuilders.wildcardQuery(field,value)
not like '%field%'notLikemust not wildcardQuery(field,value)
like '%field'likeLeftQueryBuilders.wildcardQuery(field,*value)
like 'field%'likeRightQueryBuilders.wildcardQuery(field,value*)
betweenbetweenQueryBuilders.rangeQuery('es field').from(xx).to(xx)
notBetweennotBetweenmust not QueryBuilders.rangeQuery('es field').from(xx).to(xx)
is nullisNullmust not QueryBuilders.existsQuery(field)
is notNullisNotNullQueryBuilders.existsQuery(field)
ininQueryBuilders.termsQuery(" xx es field", xx)
not innotInmust not QueryBuilders.termsQuery(" xx es field", xx)
group bygroupByAggregationBuilders.terms()
order byorderByfieldSortBuilder.order(ASC/DESC)
minminAggregationBuilders.min
maxmaxAggregationBuilders.max
avgavgAggregationBuilders.avg
sumsumAggregationBuilders.sum
order by xxx ascorderByAscfieldSortBuilder.order(SortOrder.ASC)
order by xxx descorderByDescfieldSortBuilder.order(SortOrder.DESC)
-matchmatchQuery
-matchPhraseQueryBuilders.matchPhraseQuery
-matchPrefixQueryBuilders.matchPhrasePrefixQuery
-queryStringQueryQueryBuilders.queryStringQuery
select *matchAllQueryQueryBuilders.matchAllQuery()
-highLightHighlightBuilder.Field
.........

Advertising provider

ad


ad
ad
ad

Donate Easy-Es

License

Easy-Es is under the Apache 2.0 license. See the Apache License 2.0 file for details.

elasticsearch
java
orm
resthighlevelclient

dromara/easy-es

A foolproof Elasticsearch ORM framework that is easy to use, requires minimal coding, and is highly expandable...

Java

1,586

77 commits

updated May 10, 2026

See the code

README

East-Es-Logo

Born To Simplify Development

maven code style

What is Easy-Es?

Easy-Es is a powerfully enhanced toolkit of RestHighLevelClient for simplify development. This toolkit provides some efficient, useful, out-of-the-box features for ElasticSearch. By using Easy-Es, you can use MySQL syntax to complete Es queries. Use it can effectively save your development time.

Official website

easy-es website https://en.easy-es.cn/

easy-es gitee https://gitee.com/dromara/easy-es

easy-es github https://github.com/dromara/easy-es

dromara website https://dromara.org/

dromara gitee homepage https://gitee.com/dromara/

Features

  • Automatically create and update indexes, automatically migrate data, and process zero downtime
  • Auto configuration on startup
  • Out-of-the-box interfaces for operate es
  • Powerful and flexible where condition wrapper
  • Lambda-style API
  • Automatic paging operation
  • Support high-level syntax such as highlighting and weighting and Geo etc
  • ...

Compare

Demand: Query all documents with title equals "Hi" and author equals "Guy"


// Use Easy-Es to complete the query with only 1 lines of code
List<Document> documents = documentMapper.selectList(EsWrappers.lambdaQuery(Document.class).eq(Document::getTitle, "Hi").eq(Document::getCreator, "Guy"));
// Query with RestHighLevelClient requires 11 lines of code, not including parsing JSON code
String indexName = "document";
        SearchRequest searchRequest = new SearchRequest(indexName);
        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
        TermQueryBuilder titleTerm = QueryBuilders.termQuery("title", "Hi");
        TermsQueryBuilder creatorTerm = QueryBuilders.termsQuery("creator", "Guy");
        boolQueryBuilder.must(titleTerm);
        boolQueryBuilder.must(creatorTerm);
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(boolQueryBuilder);
        searchRequest.source(searchSourceBuilder);
        try {
        SearchResponse searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
        // Then parse the DocumentList from searchResponse in various ways, omitting these codes...
        } catch (IOException e) {
        e.printStackTrace();
        }

The above is just a simple query demonstration. The more complex the actual query scene, the better the effect, which can save 3-5 times the amount of code on average.

Getting started

  • Latest Version: Maven Central

  • Add Easy-Es dependency

    • Maven:
      <dependency>
        <groupId>org.dromara.easy-es</groupId>
        <artifactId>easy-es-boot-starter</artifactId>
        <version>Latest Version</version>
      </dependency>
      
    • Gradle
      compile group: 'org.dromara.easy-es', name: 'easy-es-boot-starter', version: 'Latest Version'
      
  • Add mapper file extends BaseEsMapper interface

    public interface DocumentMapper extends BaseMapper<User> {
    }
    
  • Use it

    LambdaEsQueryWrapper<Document> wrapper = new LambdaEsQueryWrapper<>();
    wrapper.eq(Document::getTitle,"Hello World")
           .eq(Document::getCreator,"Guy");
    List<Document> documentList = documentMapper.selectList();
    
    

    Easy-Es will execute the following Query:

    {"query":{"bool":{"must":[{"term":{"title":{"value":"Hello World","boost":1.0}}},{"term":{"creator":{"value":"Guy","boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}}}
    

    The syntax of this query in MySQL is:

     SELECT * FROM document WHERE title = 'Hello World' AND creator = 'Guy'
    

This showcase is just a small part of Easy-Es features. If you want to learn more, please refer to the documentation.

Architecture

Architecture

MySQL Easy-Es and Es syntax comparison table

MySQLEasy-EsEs-DSL/Es java api
andandmust
ororshould
=eqterm
!=neboolQueryBuilder.mustNot(queryBuilder)
>gtQueryBuilders.rangeQuery('es field').gt()
>=ge.rangeQuery('es field').gte()
<lt.rangeQuery('es field').lt()
<=le.rangeQuery('es field').lte()
like '%field%'likeQueryBuilders.wildcardQuery(field,value)
not like '%field%'notLikemust not wildcardQuery(field,value)
like '%field'likeLeftQueryBuilders.wildcardQuery(field,*value)
like 'field%'likeRightQueryBuilders.wildcardQuery(field,value*)
betweenbetweenQueryBuilders.rangeQuery('es field').from(xx).to(xx)
notBetweennotBetweenmust not QueryBuilders.rangeQuery('es field').from(xx).to(xx)
is nullisNullmust not QueryBuilders.existsQuery(field)
is notNullisNotNullQueryBuilders.existsQuery(field)
ininQueryBuilders.termsQuery(" xx es field", xx)
not innotInmust not QueryBuilders.termsQuery(" xx es field", xx)
group bygroupByAggregationBuilders.terms()
order byorderByfieldSortBuilder.order(ASC/DESC)
minminAggregationBuilders.min
maxmaxAggregationBuilders.max
avgavgAggregationBuilders.avg
sumsumAggregationBuilders.sum
order by xxx ascorderByAscfieldSortBuilder.order(SortOrder.ASC)
order by xxx descorderByDescfieldSortBuilder.order(SortOrder.DESC)
-matchmatchQuery
-matchPhraseQueryBuilders.matchPhraseQuery
-matchPrefixQueryBuilders.matchPhrasePrefixQuery
-queryStringQueryQueryBuilders.queryStringQuery
select *matchAllQueryQueryBuilders.matchAllQuery()
-highLightHighlightBuilder.Field
.........

Advertising provider

ad


ad
ad
ad

Donate Easy-Es

License

Easy-Es is under the Apache 2.0 license. See the Apache License 2.0 file for details.

elasticsearch
java
orm
resthighlevelclient

Significant stargazers

钝悟

2,085 followers · starred Jan 2023

Createsequence

26 followers · starred Jun 2023

Jiangke Wu

78 followers · starred Oct 2023

Pengap

31 followers · starred Oct 2022