MySQL和EE语法对比
# MySQL和Easy-Es语法对照表
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 |
... | ... | ... |
帮助我们改善此文档 (opens new window)
上次更新: 2024/05/18