|
@@ -182,6 +182,8 @@ public class EsCountService {
|
|
|
for (EsCountVO countVO : countVOS) {
|
|
|
String field = countVO.getField();
|
|
|
Integer topN = countVO.getTopN();
|
|
|
+ String valueOne = countVO.getValueOne();
|
|
|
+ String valueTwo = countVO.getValueTwo();
|
|
|
Integer fieldType = null;
|
|
|
String type = countVO.getFieldType();
|
|
|
if (StringUtils.isNotEmpty(type) && type.equals("tree")) {
|
|
@@ -213,7 +215,7 @@ public class EsCountService {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
try {
|
|
|
- this.getDateCountDTOS(filtersAgg, field, topN, format, detailDTOS, esCountDTO);
|
|
|
+ this.getDateCountDTOS(filtersAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -238,7 +240,7 @@ public class EsCountService {
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
Aggregate termsAgg = filtersAgg.nested().aggregations().get("terms_agg");
|
|
|
try {
|
|
|
- this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
|
|
|
+ this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -299,7 +301,7 @@ public class EsCountService {
|
|
|
} else {
|
|
|
if (dateList.contains(field)) {
|
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
|
- this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO);
|
|
|
+ this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
|
|
|
} else {
|
|
|
this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
|
}
|
|
@@ -310,7 +312,7 @@ public class EsCountService {
|
|
|
}
|
|
|
} else if (nestDateList.contains(field)) {
|
|
|
Aggregate termsAgg = agg.nested().aggregations().get("terms_agg");
|
|
|
- this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
|
|
|
+ this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
|
|
|
} else if (nestChildList.contains(field)) {
|
|
|
Aggregate childAgg = agg.children().aggregations().get("childAgg");
|
|
|
this.getNestedCountDTOS(childAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
@@ -830,7 +832,8 @@ public class EsCountService {
|
|
|
* @param field
|
|
|
* @param detailDTOS
|
|
|
*/
|
|
|
- public void getDateCountDTOS(Aggregate agg, String field, Integer topN, String format, List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO) throws ParseException {
|
|
|
+ public void getDateCountDTOS(Aggregate agg, String field, Integer topN, String format, List<EsCountDetailDTO> detailDTOS,
|
|
|
+ EsCountDTO esCountDTO, String valueOne, String valueTwo) throws ParseException {
|
|
|
List<DateHistogramBucket> list = agg.dateHistogram().buckets().array();
|
|
|
esCountDTO.setAllNumber(Long.valueOf(String.valueOf(list.size())));
|
|
|
List<EsCountDetailDTO> esCountDetailDTOS = new ArrayList<>();
|
|
@@ -924,7 +927,13 @@ public class EsCountService {
|
|
|
if (aggregate != null) {
|
|
|
dto.setNumber(aggregate.filter().docCount());
|
|
|
}
|
|
|
- esCountDetailDTOS.add(dto);
|
|
|
+ if (StringUtils.isNotEmpty(valueOne) || StringUtils.isNotEmpty(valueTwo)) {
|
|
|
+ if (dto.getNumber() > 0) {
|
|
|
+ esCountDetailDTOS.add(dto);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ esCountDetailDTOS.add(dto);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|