zoukankan      html  css  js  c++  java
  • SpringBoot 集成 ElasticSearch

    @Repository
    public interface SwingCardRecordRepository extends ElasticsearchRepository<SwingCardRecordBean, String> {
    
    }
        @Autowired
        private SwingCardRecordRepository swingCardRecordRepository;
    Pageable pageable = PageRequest.of(0, 10)

    BoolQueryBuilder bqb = QueryBuilders.boolQuery();
    bqb.must(QueryBuilders.matchPhraseQuery("projectId", labourWorkerModel.getProjectId()));
    bqb.must(QueryBuilders.matchPhraseQuery("userId", labourWorkerModel.getId()));
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    bqb.must(QueryBuilders.matchPhraseQuery("recordTime", df.format(Long.valueOf(attendanceQsdDto.getScandatetime()))));
    SearchQuery query = new NativeSearchQueryBuilder()
          .withQuery(bqb)
          .withPageable(pageable)
          .build();
    Page<SwingCardRecordBean> cardRecordModelPage = swingCardRecordRepository.search(query);
     // 模糊查询
        boolQueryBuilder.filter(QueryBuilders.wildcardQuery("itemDesc", "*手机*"));
        // 范围查询 from:相当于闭区间; gt:相当于开区间(>) gte:相当于闭区间 (>=) lt:开区间(<) lte:闭区间 (<=)
        boolQueryBuilder.filter(QueryBuilders.rangeQuery("itemPrice").from(4500).to(8899));
        sourceBuilder.query(boolQueryBuilder);
  • 相关阅读:
    主动一点
    白鱼泡湿地公园
    Google管理制度(东北分公司)
    碎嘴子
    升级的时代
    SD2.0大型网站架构讨论沙龙
    旅途摘抄《12条职场秘笈》
    fscache 调研
    lxccheckpoint 一些 比较老的资料
    folly,facebook刚刚开源的底层c++函数
  • 原文地址:https://www.cnblogs.com/jiehanshi/p/14348910.html
Copyright © 2011-2022 走看看