mirror of
https://gitee.com/dromara/easy-es.git
synced 2025-12-06 17:18:57 +08:00
Merge branch 'master' of https://gitee.com/dromara/easy-es
This commit is contained in:
commit
c1205453fa
@ -167,8 +167,8 @@ QQ | 微信:252645816
|
||||
# 赞助商 | Sponsor
|
||||
---
|
||||
|
||||
> 如果您想支持我们,奈何囊中羞涩,没事,您可以花30秒借花献佛,点击下方链接进入注册,则该赞助商会代您捐赠一笔小钱给我们社区的秃头猛男们买包辣条,您可以通过微信留言"俺请秃头猛男们吃了包辣条",并提供注册截图,我们会铭记您知恩图报,并将备注您为赞助者,优先答疑.
|
||||
> 如果您想支持我们,奈何囊中羞涩,没事,您可以花30秒借花献佛,点击下方链接进入注册,则该赞助商会代您捐赠一笔小钱给社区开发者们买包辣条。
|
||||
|
||||
<a href="http://apifox.cn/a103easyse">
|
||||
<img alt="ad" src="https://iknow.hs.net/1a62e467-4f64-40d2-9705-9948a6d49982.png">
|
||||
<img alt="ad" src="https://iknow.hs.net/a26897a9-d408-4985-9ed6-b3180ea6ed98.png">
|
||||
</a>
|
||||
69
README_EN.md
69
README_EN.md
@ -137,41 +137,44 @@ String indexName = "document";
|
||||
---
|
||||

|
||||
|
||||
## Syntax comparison with MySQL
|
||||
## MySQL Easy-Es and Es syntax comparison table
|
||||
---
|
||||
| MySQL | Easy-Es |
|
||||
| ---- | ---- |
|
||||
| and | and |
|
||||
| or | or |
|
||||
| = | eq |
|
||||
| != | ne|
|
||||
| > | gt |
|
||||
| >= | ge |
|
||||
| < | lt |
|
||||
| <= | le |
|
||||
| like '%field%' | like |
|
||||
| not like '%field%' |notLike|
|
||||
| like '%field' | likeLeft|
|
||||
| like 'field%' | likeRight |
|
||||
| between | between |
|
||||
| notBetween | notBetween |
|
||||
| is null | isNull |
|
||||
| is notNull | isNotNull |
|
||||
| in | in |
|
||||
| not in | notIn |
|
||||
| group by | groupBy |
|
||||
| order by | orderBy |
|
||||
|min |min |
|
||||
|max |max |
|
||||
|avg |avg |
|
||||
|sum |sum |
|
||||
|sum |sum |
|
||||
| - | orderByAsc |
|
||||
| - | orderByDesc |
|
||||
| - | match |
|
||||
|- |highLight |
|
||||
| ... | ... |
|
||||
|
||||
| MySQL | Easy-Es | Es-DSL/Es java api|
|
||||
| --- | --- |--- |
|
||||
| and | and |must|
|
||||
| or | or | should|
|
||||
| = | eq | term|
|
||||
| != | ne | boolQueryBuilder.mustNot(queryBuilder)|
|
||||
| > | gt | QueryBuilders.rangeQuery('es field').gt()|
|
||||
| >= | ge | .rangeQuery('es field').gte()|
|
||||
| < | lt | .rangeQuery('es field').lt() |
|
||||
| <= | le | .rangeQuery('es field').lte()|
|
||||
| like '%field%' | like | QueryBuilders.wildcardQuery(field,*value*)|
|
||||
| not like '%field%' | notLike | must not wildcardQuery(field,*value*)|
|
||||
| like '%field' | likeLeft | QueryBuilders.wildcardQuery(field,*value)|
|
||||
| like 'field%' | likeRight | QueryBuilders.wildcardQuery(field,value*)|
|
||||
| between | between | QueryBuilders.rangeQuery('es field').from(xx).to(xx) |
|
||||
| notBetween | notBetween | must not QueryBuilders.rangeQuery('es field').from(xx).to(xx)|
|
||||
| is null | isNull | must not QueryBuilders.existsQuery(field) |
|
||||
| is notNull | isNotNull | QueryBuilders.existsQuery(field)|
|
||||
| in | in | QueryBuilders.termsQuery(" xx es field", xx)|
|
||||
| not in | notIn | must not QueryBuilders.termsQuery(" xx es field", xx)|
|
||||
| group by | groupBy | AggregationBuilders.terms()|
|
||||
| order by | orderBy | fieldSortBuilder.order(ASC/DESC)|
|
||||
| min | min | AggregationBuilders.min|
|
||||
| max | max |AggregationBuilders.max|
|
||||
| avg | avg |AggregationBuilders.avg|
|
||||
| sum | sum |AggregationBuilders.sum|
|
||||
| order by xxx asc | orderByAsc | fieldSortBuilder.order(SortOrder.ASC)|
|
||||
| order by xxx desc | orderByDesc |fieldSortBuilder.order(SortOrder.DESC)|
|
||||
| - | match |matchQuery|
|
||||
| - | matchPhrase |QueryBuilders.matchPhraseQuery|
|
||||
| - | matchPrefix |QueryBuilders.matchPhrasePrefixQuery|
|
||||
| - | queryStringQuery |QueryBuilders.queryStringQuery|
|
||||
| select * | matchAllQuery |QueryBuilders.matchAllQuery()|
|
||||
| - | highLight |HighlightBuilder.Field |
|
||||
| ... | ... | ...|
|
||||
---
|
||||
|
||||
## Donate
|
||||
|
||||
@ -222,14 +222,11 @@ public class WrapperProcessor {
|
||||
Optional.ofNullable(wrapper.from).ifPresent(searchSourceBuilder::from);
|
||||
MyOptional.ofNullable(wrapper.size).ifPresent(searchSourceBuilder::size, DEFAULT_SIZE);
|
||||
|
||||
if (searchSourceBuilder.size() > DEFAULT_SIZE) {
|
||||
// 查询超过一万条, trackTotalHists自动开启
|
||||
searchSourceBuilder.trackTotalHits(true);
|
||||
} else {
|
||||
// 根据全局配置决定是否开启
|
||||
searchSourceBuilder.trackTotalHits(GlobalConfigCache.getGlobalConfig().getDbConfig().isEnableTrackTotalHits());
|
||||
// 根据全局配置决定是否开启
|
||||
if (GlobalConfigCache.getGlobalConfig().getDbConfig().isEnableTrackTotalHits()) {
|
||||
searchSourceBuilder.trackTotalHits(Boolean.TRUE);
|
||||
}
|
||||
|
||||
|
||||
return searchSourceBuilder;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user