whats new in v2.0.0-betaX
# v2.0.0-beta1
2.0.0-beta1 is the first release of Easy-Es in 2023, sorry for the late arrival of version 2.0.
This is a milestone release, not a minor one, so it has been a long time coming, with the algorithms for the four nested query types taking nearly a year of fragmentation to explore.
2.0.0-beta1 provides more than 10 new features, more than 10 enhancements, one bug fix, and further documentation on the official website and a full project presentation PPT.
# v2.0.0-beta2
- Added a new mixed query mode, the biggest feature of this version, the king of bomb level, refer to Extensions -> Mixed Query -> The correct use of mixed query posture posture "0"
- Add a new feature to quickly specify the query field case ignore by custom annotation, refer to Quick Start -> Annotations -> @IndexField annotation ignoreCase property
- Optimize the banner display, k for all lengths of version numbers, to make a more friendly display effect
- Add the log when autoShift is created or updated, so that users can better perceive what the framework actually does to the index when autoShift is on?
- fix the minShouldMatch parameter in multiMatch does not automatically add the percentage sign defect
- fix the four nested types algorithm in some special complex scenarios can not correctly restore the lambda expression defects
- Fix the defect that the distance field cannot return the distance correctly when multiple sorters are specified and the first sorters are not sorted by distance.
# v2.0.0-beta3
- A new method of setting minScore is added, which can easily filter documents with scores lower than the specified score threshold.
- Add the method of setting trackScores to set the query calculation score.
- Add a method of setting preference to set query preference.
- Adjust the default type of bigDecimal from keyword to SCALED_FLOAT.
- queryString will no longer preprocess user parameters, such as hump and underline conversion, etc., and the original data passed by the user will prevail, which can prevent the wrong conversion of non-fields in the query string.
- groupBy no longer specifies the default aggregation bucket size, which solves the problem of aggregation error when some users have different es versions.
- Adjust the default hosting type of the index to manual, so as to avoid all kinds of 100,000 whys when novice users don't use and understand the smooth mode properly, and adjust the document guide synchronously.
- Fix Issue https://gitee.com/dromara/easy-es/issues/I7JYHH.
- Fix Issue https://gitee.com/dromara/easy-es/issues/I7JYJR.
# v2.0.0-beta4
-Add @MultiIndexField annotation and @InnerIndexField annotation, which can be used to specify multiple word splitters in a single field. -@IndexName annotation adds the refreshPolicy attribute, which can control the function of index refresh strategy in a finer granularity. -@HighLight annotation adds the numberOfFragments attribute, and users can customize the number of highlighted fragments returned by search. -@IndexField adds the ignoreAbove attribute, and users can customize the index content length limit, with the default value of 256. -@IndexField adds scalingFactor attribute, and users can customize the scaling factor of floating-point number field. -upgrade Lombok version to latest version 1.18.28. -Added support for springboot3 and jdk20, so far: springboot1.x~3.x, jdk8~20. -Fixed the problem that #I7RE3Z highlights were missing highlights. -Fix #I7P65Z BigDecimal index creation failure. -Fixed the problem that data migration in smooth mode failed when the setting of #I7SE3K maxResultWindow was less than 1W. -Related documents are updated synchronously.
# v2.0.0-beta5
- Provides nested type highlighting query function (important feature), still using the original @HighLight annotation, making it user-friendly
- Provides multi-data source function (major feature). This function is contributed by the community Liyy and merged and optimized by Laohan.
- Provides https connection to ES, which can avoid SSL verification. This function was contributed and verified by community developer "Yang Zhongcheng", and Laohan merged and optimized it.
- @IndexField adds dense_vector and dims specifications, and is compatible with automatic creation of various index modes to support vector type data retrieval. Contributed by the community zhangsan@alona, Laohan merged and optimized
- Provides a little black man mode to make coding more interesting. It is turned off by default and can be turned on through configuration. It is for entertainment only. Users are not allowed to use it for other purposes. You are responsible for the consequences...
- Fix the NPE problem that occurs when the entity class introduced by #I7T1A6 bete4 is not annotated with @IndexName
- Fixed the problem that the highlight annotation did not take effect in the scene marked by #I8XZGP @MultiField. Contributed by the community lym, Laohan merged and optimized
- Fix #I8XZID and adjust the return type of the batch refresh api interface to the number of successfully refreshed shards, solving the problem of incorrect refresh status returned when a shard refresh fails in some scenarios.
- The pit avoidance document adds specifications for the use of _id in es, which can avoid pitfalls that may cause OOM and performance problems. A must-read for es newbies
- Optimize the problem of "reverse Tiangang" in longitude and latitude related documents in GEO, adjust it so that latitude comes first and longitude comes last.
- Documents related to new features are updated simultaneously
# v2.0.0-beta6
- Added parent-child type index automation support for one parent with many children and one parent with many children with many grandchildren (significant feature)
- Increased support for all query functions of parent-child types (significant feature)
- Provide a brand-new custom annotation @Settings, support convenient preset and flexible customization, and support convenient handling of all settings in ES index (significant feature).
- All CRUD methods support custom routing function of method granularity.
- Printing of routing is added in DSL statement printing.
- Javadoc and comments and some code details optimization
# v2.0.0-beta7
- Added annotation-free support and default format support for LocalDate, LocalDateTime, and Date date type fields.
- Added RequestOptions custom API to further improve scalability
- Fixed the problem of #I7HNQZ multi-sort distance not taking effect
- Fix #I9BIPO Springboot3.1.7 incompatibility issue
- Fix #I9BIPV In automatic mode, if the parent-child type relationship annotation is not specified, the index cannot be hosted (introduced in beta6)
# v2.0.0-beta8
- The new highlighted field supports setting requireFieldMatch, which can specify whether the highlight matches the query field (community PR merge)
- Added mapper custom default method function (community pr merge)
- The parent-child type @Join annotation adds the eagerGlobalOrdinals attribute, which can be used to specify whether to create a global ordinal to improve query performance.
- Fixed the problem of the parent-child type introduced in beat6 - smooth mode, which caused the restart project to misjudge the index change and automatically update the index due to the default value of eagerGlobalOrdinals.
- Fixed the label coverage problem when highlighting multiple fields and using different highlight labels respectively.
# When will 2.0.0 be released?
It is planned to complete the official release of version 2.0 this year (2023), because the changes in version 2.0 are indeed very large, the core code has almost been changed, and 2.x brings a large number of new features compared to 1.x. It can be said that it is completely reborn. In order to ensure the stability and reliability of the official version 2.0.0 and win reputation for EE, we will push it into multiple beta versions. Since I am not a full-time open source, I have to work for five buckets of rice. Therefore, the specific release date is subject to the actual completion time. I will do my best to iterate, thank you for your understanding!
- v2.0.0-beta1
- v2.0.0-beta2
- v2.0.0-beta...
- v2.0.0-beta8
- v2.0.0 pushes the official version
We are working hard to keep improving, and we welcome everyone with lofty ideals to join us at any time...
# Can 2.0.0-beta1 be used in production?
My answer is yes, but only if you will modify the source code yourself, or if your company does not use ES for core scenarios, such as basic document retrieval or some non-2C business, even though our version is called beta, But before going online are strictly tested, there are a large number of automated test cases cover to ensure that the core functionality is stable and reliable, the user in the process of use for the development of good features can also be tested again, so basically can complete the production In case there is a known defect, you can solve it by mixing or modifying the source code, and we will also fix the defects in beta1 in beta2.
# Four major nested queries support
In fact, there have been 2 algorithm tuning in this area, plus this is the third time, the first two of which were on the wrong path, so the best results could not be achieved even after racking our brains, So the version before 2.X in more than 2 levels of nested complex queries can not be achieved by the way out of the box. After a year-long exploration, we finally solved 4 kinds of nested queries and support stepless nesting, No matter how complex the query conditions are, no matter how deep the hierarchy is, you can easily handle it.
MySQL | Mybatis-Plus | ES | Easy-Es |
---|---|---|---|
and splice | default | must | default |
or splice | or() | should | or() |
none | none | filter | filter() |
none | none | must_not | not() |
Visual comparison
// MySQL syntax
where business_type = 1
and (state = 9 or (state = 8 and bidding_sign = 1))
or (business_type = 2 and state in (2,3));
// Easy-Es and Mybatis-Plus syntax
wrapper.eq("business_type", 1)
.and(a -> a.eq("state", 9).or(b -> b.eq("state", 8).eq("bidding_sign", 1)))
.or(i -> i.eq("business_type", 2).in("state", 2, 3));
// ES native RestHighLevel syntax
List<Integer> values = Arrays.asList(2, 3);
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
boolQueryBuilder.must(QueryBuilders.termQuery("business_type", 1));
boolQueryBuilder.must(QueryBuilders.boolQuery()); boolQueryBuilder.must(QueryBuilders.termQuery()
.must(QueryBuilders.termQuery("state", 9))
.should(QueryBuilders.boolQuery().must(QueryBuilders.termQuery("state", 8))
.must(QueryBuilders.termQuery("bidding_sign", 1))));
boolQueryBuilder.should(QueryBuilders.boolQuery().must(QueryBuilders.termQuery("business_type", 2))
.must(QueryBuilders.termsQuery("state", values)));
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
The maximum depth of the tree in the above example is only 2. If the depth exceeds 2, the ES native syntax will be difficult to understand, let alone code correctly, and even if you are an ES veteran, you will easily fall into the hole, but now you can easily and simply restore complex SQL with EE 1:1.
# Full query support for nested types
In version 1.X, the out-of-the-box query API for nested types only supported match, in version 2.x you can support all nested types of queries, just pass them in as Consumers, contributed by community developer @lym
- API
nested(String path, Consumer<Param> consumer);
- Use the demo
@Test
public void testNestedMatch() {
// nested query query for age equal to 18 or 8 and password equal to 123
LambdaEsQueryWrapper<Document> wrapper = new LambdaEsQueryWrapper<>();
wrapper.nested(FieldUtils.val(Document::getUsers), w ->
w.in(FieldUtils.val(User::getAge), 18, 8)
.eq(FieldUtils.val(User::getPassword), "123"));
List<Document> documents = documentMapper.selectList(wrapper);
System.out.println(documents);
}
2
3
4
5
6
7
8
9
10
# Auto-splice .keyword suffix based on context
The default field type is adjusted from keyword to text_keyword when the index is created, and the .keyword suffix will be automatically and intelligently spliced according to the query type and the type configured in the annotation, keyword suffix, and can be configured to turn on/off auto-splicing, which can enhance the range of field query support, reduce user workload, and significantly reduce the possibility of white people stepping on the ES pit.
# All conditional constructors support chaining
All conditional constructors support chained calls (including indexing), and MP like chaining programming
@Test
public void testOne() {
// chain call
Document document = EsWrappers.lambdaChainQuery(documentMapper).eq(Document::getTitle, "Test Document 3").one();
}
2
3
4
5
# Distance is much simpler to get
@Distance get distance annotation, new support for multiple fields, multiple sorters, and no longer need to manually specify the sorting iterator position by the user, the framework is fully automated processing, easier to use.
# other new features
- New field type wildcard type manual automatic gearbox are applicable
- provide index manual refresh interface , the trigger is freely controlled by the user , the previous index refresh policy configuration still retains automatic + manual matching
- Provide support for direct execution of static DSL statements
- Provide direct execution of SQL API
- Provide the function of setting route by custom annotation
# Other optimizations
- Remove the original not-headed API and the APIs that indicate the inverse (historical reasons, unreasonable design, decided to completely deprecate), such as notIn, notBetween, NE, etc. Now all the inverse can be directly solved by the not provided in the four nested types
- geo geographic query into the Bool query conditions, you can also enjoy must/should/filter/mustNot, the original function is not affected, can be interpreted as more powerful and flexible
- Deprecated the configuration item enableMust2Filter, you can directly use filter nesting simpler, more standardized, finer granularity
- Refactored WrapperProcess core logic and AbstractWrapper core logic Code structure is clearer, core logic is simpler and easier to read than the original, basically fool level, easy to maintain a higher level of maintenance
- Mark the array type and object type in the obsolete FieldType, and explain the correct type that should be used by commenting to prevent es from stepping on the pit.
- Adjust the default value of rebuilding index timeout to 72H and the default value of socketTimeOut and other parameters to further prevent white people from stepping on the index migration timeout failure.
- Add the default maximum connection timeout and heartbeat time, and give a suitable value to help the little white guys who don't know ES to step on the pit as much as possible.
- @Distance gets the distance annotation, which supports multi-field and multi-sorter functions, and it doesn't need the user to manually specify the position of sorting iterator, which is automatically handled by the framework, making it easier to use.
- Further enriched the official website document, using it more foolishly, and each overloaded method in the source code is annotated, making it more user-friendly.
# Defect fix
Fix the inaccuracy of the decimal place of the distance retained by the @Distance annotation in some scenarios.