Easy-Es Easy-Es
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)

adv display by random ❤️become sponsor
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
  • Quick start

    • Introduction.md
    • Applicable scene
    • Worry free
    • Avoid pit
    • Quick start
    • Springboot demo
    • Spring Integration Guide
    • Solon Integration Guide
    • Config
    • Annotation
  • Core function

    • Condition constructor

      • Introduction of Wrapper
      • Index wrapper
      • Select wrapper
      • Update wrapper
    • Index CRUD

      • Index hosting model
      • Index CRUD
    • Data CRUD

      • Data synchronization solutions
      • Data CRUD
    • Multiple data sources support
    • Dynamic indexing support
    • Four nested query
    • Chain call
  • Extended function

    • Mixed query
    • Origin query
    • Page
    • Nested
    • Join parent child
    • Get DSL
    • ExecuteDSL
    • Execute SQL
    • Custom RequestOptions
    • Custom default method
  • High-level syntax

    • Field filtering
      • 1. Forward filtering (only query the specified field)
      • 2. Reverse filtering (do not query the specified field)
    • Sort
    • Aggregation
    • Match&fuzzy match
    • Weight
    • Highlight
    • Geo
    • IP
  • Plugin

    • Plugin
  • Other

    • Faq
    • Difference from MP
    • MySQL and EE syntax comparison
    • Update log
    • Update plan
    • Copyright
    • Thanks
  • v2.xDoc
  • High-level syntax
LaoHan
2023-03-18
目录

Field filtering

if you don't want to look up some big fields in some queries, you can filter the fields of the query.

# 1. Forward filtering (only query the specified field)

@Test
public void testFilterField() {
//The test only queries the specified fields.
LambdaEsQueryWrapper<Document> wrapper = new LambdaEsQueryWrapper<>();
String title = "old man";
wrapper.eq(Document::getTitle, title);
wrapper.select(Document::getTitle);
Document document = documentMapper.selectOne(wrapper);
System.out.println(document);
}
1
2
3
4
5
6
7
8
9
10

# 2. Reverse filtering (do not query the specified field)

@Test
public void testNotFilterField() {
//The test does not query the specified field (recommended)
LambdaEsQueryWrapper<Document> wrapper = new LambdaEsQueryWrapper<>();
String title = "old man";
wrapper.eq(Document::getTitle, title);
wrapper.notSelect(Document::getTitle);
Document document = documentMapper.selectOne(wrapper);
System.out.println(document);

//another Lambda writing method consistent with mp grammar
LambdaEsQueryWrapper<Document> wrapper1 = new LambdaEsQueryWrapper<>();
wrapper1.select(Document.class, d -> ! Objects.equals(d.getColumn(), "title"));
Document document1 = documentMapper.selectOne(wrapper);
System.out.println(document1);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

提示

You can only choose one of forward filtering and reverse filtering. If you use both filtering rules at the same time, the conflicting fields will lose their filtering effect.

Help us improve this document (opens new window)
Last update: 2024/03/29
Custom default method
Sort

← Custom default method Sort→

Theme by Vdoing | Copyright © 2021-2025 LaoHan | Zhejiang ICP No. 2022020479 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式