如题,求救
sql: select * from table where active=1 and ( name like '%?%' or code like '%?%' )
elasticsearch 用java client怎么写呢?
--------------------------------------
3Q!
我这么写的
QueryBuilder qb = QueryBuilders.boolQuery()
.must(new QueryStringQueryBuilder("1").field("active"))
.must(QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery("name", "小李子"))
.should(QueryBuilders.matchQuery("code", 小李子"))
);
sql: select * from table where active=1 and ( name like '%?%' or code like '%?%' )
elasticsearch 用java client怎么写呢?
--------------------------------------
3Q!
我这么写的
QueryBuilder qb = QueryBuilders.boolQuery()
.must(new QueryStringQueryBuilder("1").field("active"))
.must(QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery("name", "小李子"))
.should(QueryBuilders.matchQuery("code", 小李子"))
);
1 个回复
helloes
赞同来自: