|
@@ -463,14 +463,6 @@ public class EsCountService {
|
|
|
*/
|
|
|
public void getTermCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS) {
|
|
|
List<StringTermsBucket> list = agg.sterms().buckets().array();
|
|
|
- Long otherDocCount = agg.sterms().sumOtherDocCount();
|
|
|
- if (otherDocCount > 0) {
|
|
|
- EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
|
- dto.setField(field);
|
|
|
- dto.setName("未知");
|
|
|
- dto.setNumber(otherDocCount);
|
|
|
- detailDTOS.add(dto);
|
|
|
- }
|
|
|
list.forEach(bucket -> {
|
|
|
EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
|
dto.setField(field);
|
|
@@ -637,14 +629,6 @@ public class EsCountService {
|
|
|
*/
|
|
|
public void getNestedCountDTOS(Aggregate agg, String field, List<EsCountDetailDTO> detailDTOS) {
|
|
|
Aggregate termsAgg = agg.nested().aggregations().get("terms_agg");
|
|
|
- Long otherDocCount = termsAgg.sterms().sumOtherDocCount();
|
|
|
- if (otherDocCount > 0) {
|
|
|
- EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
|
- dto.setField(field);
|
|
|
- dto.setName("未知");
|
|
|
- dto.setNumber(otherDocCount);
|
|
|
- detailDTOS.add(dto);
|
|
|
- }
|
|
|
List<StringTermsBucket> list = termsAgg.sterms().buckets().array();
|
|
|
list.forEach(bucket -> {
|
|
|
EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
@@ -722,7 +706,7 @@ public class EsCountService {
|
|
|
Aggregation aggregation = null;
|
|
|
if (esConfigVO != null) {
|
|
|
iEsCountAnalysisBuilder = esCountAnalysisBuilderFactory.getClass(esConfigVO.getEsClass());
|
|
|
- iEsCountAnalysisBuilder.setField(field);
|
|
|
+ iEsCountAnalysisBuilder.setField(esConfigVO.getEsField());
|
|
|
iEsCountAnalysisBuilder.setValueOne(valueOne);
|
|
|
iEsCountAnalysisBuilder.setValueTwo(valueTwo);
|
|
|
iEsCountAnalysisBuilder.setValues(values);
|
|
@@ -764,11 +748,19 @@ public class EsCountService {
|
|
|
if (StringUtils.isNotEmpty(field)) {
|
|
|
List<FiltersBucket> filtersBuckets = agg.filters().buckets().array();
|
|
|
if (dateList.contains(field)) {
|
|
|
- filtersBuckets.forEach(filtersBucket -> {
|
|
|
- this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
- Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
- this.getDateCountDTOS(filtersAgg, field, topN, detailDTOS);
|
|
|
- });
|
|
|
+ if (CollectionUtils.isEmpty(values)) {
|
|
|
+ filtersBuckets.forEach(filtersBucket -> {
|
|
|
+ this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
+ Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
+ this.getDateCountDTOS(filtersAgg, field, topN, detailDTOS);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ filtersBuckets.forEach(filtersBucket -> {
|
|
|
+ this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
+ Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
+ this.getDateAnalysisDTOS(filtersAgg, field, topN, detailDTOS);
|
|
|
+ });
|
|
|
+ }
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
@@ -781,6 +773,16 @@ public class EsCountService {
|
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
this.getChildCountDTOS(filtersAgg, field, detailDTOS);
|
|
|
});
|
|
|
+ } else if (numberList.contains(field)) {
|
|
|
+ if (CollectionUtils.isEmpty(values)) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ filtersBuckets.forEach(filtersBucket -> {
|
|
|
+ this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
|
+ Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
|
+ this.getNumberAnalysisDTOS(filtersAgg, field, detailDTOS);
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
|
this.getFiltersCountDTO(filtersBucket, finalSearchCondition, detailDTOS);
|
|
@@ -793,7 +795,11 @@ public class EsCountService {
|
|
|
}
|
|
|
} else {
|
|
|
if (dateList.contains(field)) {
|
|
|
- this.getDateAnalysisDTOS(agg, field, topN, detailDTOS);
|
|
|
+ if (CollectionUtils.isEmpty(values)) {
|
|
|
+ this.getDateCountDTOS(agg, field, topN, detailDTOS);
|
|
|
+ } else {
|
|
|
+ this.getDateAnalysisDTOS(agg, field, topN, detailDTOS);
|
|
|
+ }
|
|
|
} else if (nestedList.contains(field)) {
|
|
|
this.getNestedCountDTOS(agg, field, detailDTOS);
|
|
|
} else if (childList.contains(field)) {
|