|
@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
public class EsCountService {
|
|
public class EsCountService {
|
|
- private final List<String> termList = Arrays.asList();
|
|
|
|
|
|
+ private final List<String> childList = Arrays.asList("childRaw");
|
|
private final List<String> nestedList = Arrays.asList("PA", "IN", "PE");
|
|
private final List<String> nestedList = Arrays.asList("PA", "IN", "PE");
|
|
private final List<String> dateList = Arrays.asList("PD", "AD");
|
|
private final List<String> dateList = Arrays.asList("PD", "AD");
|
|
|
|
|
|
@@ -112,6 +112,22 @@ public class EsCountService {
|
|
detailDTOS.add(dto);
|
|
detailDTOS.add(dto);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ } else if (childList.contains(field)) {
|
|
|
|
+ Aggregate childAgg = agg.children().aggregations().get("child_agg");
|
|
|
|
+ List<StringTermsBucket> list = childAgg.sterms().buckets().array();
|
|
|
|
+ list.forEach(bucket -> {
|
|
|
|
+ EsCountDetailDTO dto = new EsCountDetailDTO();
|
|
|
|
+ dto.setField(field);
|
|
|
|
+ Aggregate aggregate = bucket.aggregations().get("filter_agg");
|
|
|
|
+ dto.setName(bucket.key().stringValue());
|
|
|
|
+ dto.setNumber(bucket.docCount());
|
|
|
|
+ if (aggregate != null) {
|
|
|
|
+ dto.setNumber(aggregate.filter().docCount());
|
|
|
|
+ }
|
|
|
|
+ if (dto.getNumber() > 0) {
|
|
|
|
+ detailDTOS.add(dto);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
List<StringTermsBucket> list = agg.sterms().buckets().array();
|
|
List<StringTermsBucket> list = agg.sterms().buckets().array();
|
|
list.forEach(bucket -> {
|
|
list.forEach(bucket -> {
|