|
@@ -139,13 +139,13 @@ public class EsCountService {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, condition, detailDTOS);
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
- this.getNestedCountDTOS(filtersAgg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(filtersAgg, field, detailDTOS);
|
|
|
});
|
|
|
} else if (childList.contains(field)) {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, condition, detailDTOS);
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
- this.getChildCountDTOS(filtersAgg, field, detailDTOS);
|
|
|
+ this.getChildCountDTOS(filtersAgg, field, detailDTOS,esCountDTO);
|
|
|
});
|
|
|
} else {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
@@ -161,9 +161,9 @@ public class EsCountService {
|
|
|
if (dateList.contains(field)) {
|
|
|
this.getDateCountDTOS(agg, field, topN, detailDTOS,esCountDTO);
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
- this.getNestedCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(agg, field, detailDTOS);
|
|
|
} else if (childList.contains(field)) {
|
|
|
- this.getChildCountDTOS(agg, field, detailDTOS);
|
|
|
+ this.getChildCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
} else {
|
|
|
this.getTermCountDTOS(agg, field, detailDTOS);
|
|
|
}
|
|
@@ -265,7 +265,7 @@ public class EsCountService {
|
|
|
if (dateList.contains(field)) {
|
|
|
this.getDateAnalysisDTOS(agg, field, topN, detailDTOS,esCountDTO);
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
- this.getNestedCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(agg, field, detailDTOS);
|
|
|
} else if (childList.contains(field)) {
|
|
|
this.getChildAnalysisDTOS(agg, field, detailDTOS, esCountDTO);
|
|
|
} else if (numberList.contains(field)) {
|
|
@@ -365,7 +365,7 @@ public class EsCountService {
|
|
|
if (dateList.contains(field)) {
|
|
|
this.getDateAnalysisDTOS(agg, field, topN, detailDTOS,esCountDTO);
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
- this.getNestedCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(agg, field, detailDTOS);
|
|
|
} else if (childList.contains(field)) {
|
|
|
this.getChildAnalysisDTOS(agg, field, detailDTOS, esCountDTO);
|
|
|
} else if (numberList.contains(field)) {
|
|
@@ -485,7 +485,8 @@ public class EsCountService {
|
|
|
* @param field
|
|
|
* @param detailDTOS
|
|
|
*/
|
|
|
- public void getChildCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS) {
|
|
|
+ public void getChildCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO) {
|
|
|
+ esCountDTO.setAllNumber(agg.children().docCount());
|
|
|
Aggregate childAgg = agg.children().aggregations().get("childAgg");
|
|
|
List<StringTermsBucket> list = childAgg.sterms().buckets().array();
|
|
|
list.forEach(bucket -> {
|
|
@@ -611,7 +612,7 @@ public class EsCountService {
|
|
|
*/
|
|
|
public void getDateAnalysisDTOS(Aggregate agg, String field, Integer topN, List<EsCountDetailDTO> detailDTOS,EsCountDTO esCountDTO) {
|
|
|
List<RangeBucket> list1 = agg.dateRange().buckets().array();
|
|
|
- esCountDTO.setAllNumber(Long.valueOf(String.valueOf(list1.size())));
|
|
|
+// esCountDTO.setAllNumber(Long.valueOf(String.valueOf(list1.size())));
|
|
|
List<EsCountDetailDTO> esCountDetailDTOS = new ArrayList<>();
|
|
|
for (RangeBucket bucket : list1) {
|
|
|
EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
@@ -636,8 +637,7 @@ public class EsCountService {
|
|
|
* @param field
|
|
|
* @param detailDTOS
|
|
|
*/
|
|
|
- public void getNestedCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS,EsCountDTO esCountDTO) {
|
|
|
- esCountDTO.setAllNumber(agg.nested().docCount());
|
|
|
+ public void getNestedCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS) {
|
|
|
Aggregate termsAgg = agg.nested().aggregations().get("terms_agg");
|
|
|
List<StringTermsBucket> list = termsAgg.sterms().buckets().array();
|
|
|
list.forEach(bucket -> {
|
|
@@ -768,14 +768,17 @@ public class EsCountService {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
- this.getNestedCountDTOS(filtersAgg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(filtersAgg, field, detailDTOS);
|
|
|
+ if (!CollectionUtils.isEmpty(values)) {
|
|
|
+ esCountDTO.setAllNumber(filtersAgg.nested().docCount());
|
|
|
+ }
|
|
|
});
|
|
|
} else if (childList.contains(field)) {
|
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
- this.getChildCountDTOS(filtersAgg, field, detailDTOS);
|
|
|
+ this.getChildCountDTOS(filtersAgg, field, detailDTOS,esCountDTO);
|
|
|
});
|
|
|
} else {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
@@ -812,10 +815,13 @@ public class EsCountService {
|
|
|
this.getDateAnalysisDTOS(agg, field, topN, detailDTOS,esCountDTO);
|
|
|
}
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
- this.getNestedCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
+ this.getNestedCountDTOS(agg, field, detailDTOS);
|
|
|
+ if (!CollectionUtils.isEmpty(values)) {
|
|
|
+ esCountDTO.setAllNumber(agg.nested().docCount());
|
|
|
+ }
|
|
|
} else if (childList.contains(field)) {
|
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
|
- this.getChildCountDTOS(agg, field, detailDTOS);
|
|
|
+ this.getChildCountDTOS(agg, field, detailDTOS,esCountDTO);
|
|
|
} else {
|
|
|
this.getChildAnalysisDTOS(agg, field, detailDTOS, esCountDTO);
|
|
|
}
|