|
@@ -210,59 +210,18 @@ public class EventServiceTests {
|
|
|
|
|
|
@Test
|
|
|
void test5() throws IOException {
|
|
|
-// SelectClaimDTO dto = esService.selectClaim("CN102324864A");
|
|
|
-// System.out.println(dto);
|
|
|
-
|
|
|
- Aggregation range = AggregationBuilders.range(n -> n.field("app_date").format("yyyy"));
|
|
|
- Aggregation aggregation = AggregationBuilders.dateHistogram(i -> i.field("app_date").format("yyyy").calendarInterval(CalendarInterval.Year));
|
|
|
- Query query = QueryBuilders.range(j -> j.field("app_date").from("2021").to("2023"));
|
|
|
- Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
|
|
|
- aggregation.aggregations().put("filter_agg",filter);
|
|
|
-
|
|
|
- System.out.println(aggregation);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- void test6() {
|
|
|
- String valueOne = "H02";
|
|
|
- Aggregation aggregation = AggregationBuilders.terms(i -> i.field("mipc.level2").size(10));
|
|
|
- if (StringUtils.isNotEmpty(valueOne)) {
|
|
|
- Query query = QueryBuilders.term(j -> j.field("mipc.level2").value(valueOne));
|
|
|
- Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
|
|
|
- Map<String, Aggregation> map = aggregation.aggregations();
|
|
|
- System.out.println(map + "----------------");
|
|
|
- map.put("filter_agg", filter);
|
|
|
- System.out.println(map);
|
|
|
- }
|
|
|
- System.out.println(aggregation);
|
|
|
+ SelectClaimDTO dto = esService.selectClaim("CN102324864A");
|
|
|
+ System.out.println(dto);
|
|
|
}
|
|
|
-
|
|
|
- @Test
|
|
|
- void test7() {
|
|
|
- String valueOne = "";
|
|
|
- Aggregation terms = AggregationBuilders.terms(j -> j.field("applicant.name.key").size(10));
|
|
|
- if (StringUtils.isNotEmpty(valueOne)) {
|
|
|
- Query query = QueryBuilders.term(j -> j.field("applicant.name.key").value(valueOne));
|
|
|
- Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
|
|
|
- terms.aggregations().put("filter_agg",filter);
|
|
|
- }
|
|
|
- Aggregation aggregation = AggregationBuilders.nested(i -> i.path("applicant")).aggregations().put("terms_agg", terms);
|
|
|
- System.out.println(aggregation);
|
|
|
- }
|
|
|
-
|
|
|
@Test
|
|
|
void test8() throws Exception {
|
|
|
-// String valueOne = "";
|
|
|
-// String str = "*";
|
|
|
-// String s = str.concat(valueOne).concat("*");
|
|
|
-// Query query = QueryBuilders.wildcard(i -> i.field("").value(s));
|
|
|
-// Aggregation aggregation = AggregationBuilders.filter(i -> i.bool(j -> j.must(query)));
|
|
|
-// System.out.println(aggregation);
|
|
|
EsCountVO vo = new EsCountVO();
|
|
|
- vo.setField("PT");
|
|
|
- vo.setValueOne("1");
|
|
|
// vo.setField("PA");
|
|
|
+// vo.setField("CO");
|
|
|
+ vo.setField("PT");
|
|
|
+// vo.setValueOne("1");
|
|
|
+// vo.setValueTwo("1");
|
|
|
+// vo.setField("AD");
|
|
|
EsCountDTO esCountDTO = esCountService.esCountSearch(vo);
|
|
|
System.out.println(esCountDTO);
|
|
|
|