88 ElasticSearch Java API 多种条件的组合搜索

论坛 期权论坛 脚本     
匿名技术用户   2020-12-22 12:23   11   0

88 ElasticSearch Java API 多种条件的组合搜索

概述

https://github.com/csy512889371/learndemo/tree/master/es-senior

QueryBuilder qb = boolQuery()
    .must(matchQuery("brand", "宝马"))    
    .mustNot(termQuery("name.raw", "宝马318")) 
    .should(termQuery("produce_date", "2017-01-02"))  
    .filter(rangeQuery("price").gte("280000").lt("350000"));

SearchResponse response = client.prepareSearch("car_shop")
        .setTypes("cars")
        .setQuery(qb)                
        .get();
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP