Commit 061ba903 authored by tianyiming's avatar tianyiming

修改bug

parent 8d84959f
...@@ -46,9 +46,7 @@ import org.elasticsearch.client.core.CountResponse; ...@@ -46,9 +46,7 @@ import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.*; import org.elasticsearch.index.query.*;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortBuilders;
...@@ -711,6 +709,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -711,6 +709,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
dto.get("unitType").toString().contains("安装改造维修单位"))) { dto.get("unitType").toString().contains("安装改造维修单位"))) {
permissionStatus = noneStr; permissionStatus = noneStr;
} }
if(dto.get("unitType").equals("使用单位") || dto.get("unitType").equals("个人主体")){
permissionStatus = null;
}
dto.put("permissionStatus", permissionStatus); dto.put("permissionStatus", permissionStatus);
list.add(dto); list.add(dto);
} }
...@@ -735,7 +736,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -735,7 +736,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (!"".equals(permitStatusStr)) { if (!"".equals(permitStatusStr)) {
getFilterCompanyOrPersonPermitStatusStatic(staticMap, StatisticalAnalysisEnum.company.getKey(), permitStatusStr, totle); getFilterCompanyOrPersonPermitStatusStatic(staticMap, StatisticalAnalysisEnum.company.getKey(), permitStatusStr, totle);
} else { } else {
getCompanyOrPersonPermitStatusStatic(boolMust, staticMap, StatisticalAnalysisEnum.person.getKey()); getCompanyOrPersonPermitStatusStatic(boolMust, staticMap, StatisticalAnalysisEnum.company.getKey());
} }
result.put("keyIndicator", staticMap); result.put("keyIndicator", staticMap);
...@@ -820,7 +821,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -820,7 +821,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
} else if (item.equals(none)) { } else if (item.equals(none)) {
NestedQueryBuilder nestedQuery = QueryBuilders.nestedQuery( NestedQueryBuilder nestedQuery = QueryBuilders.nestedQuery(
path, path,
QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(nestedField)), QueryBuilders.boolQuery().mustNot(existsQuery(nestedField)),
ScoreMode.None ScoreMode.None
); );
enhancedDynamicQueryBuilder.add(nestedQuery, or); enhancedDynamicQueryBuilder.add(nestedQuery, or);
...@@ -1020,7 +1021,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1020,7 +1021,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
DynamicQueryBuilder dynamicQueryBuilder = new DynamicQueryBuilder(); DynamicQueryBuilder dynamicQueryBuilder = new DynamicQueryBuilder();
dynamicQueryBuilder.or(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode)); dynamicQueryBuilder.or(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
dynamicQueryBuilder.or(QueryBuilders.boolQuery().must(QueryBuilders.termQuery("ORG_BRANCH_CODE", ""))); dynamicQueryBuilder.or(QueryBuilders.boolQuery().must(QueryBuilders.termQuery("ORG_BRANCH_CODE", "")));
dynamicQueryBuilder.or(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("ORG_BRANCH_CODE"))); dynamicQueryBuilder.or(QueryBuilders.boolQuery().mustNot(existsQuery("ORG_BRANCH_CODE")));
boolMust.must(dynamicQueryBuilder.build()); boolMust.must(dynamicQueryBuilder.build());
} else { } else {
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode)); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
...@@ -1064,7 +1065,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1064,7 +1065,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 正常:大于当前日期加上30天 // 正常:大于当前日期加上30天
queryBuilder.add(QueryBuilders.boolQuery().filter(QueryBuilders.rangeQuery(finalField).gt(LocalDate.now().plusDays(30).format(formatter))), or); queryBuilder.add(QueryBuilders.boolQuery().filter(QueryBuilders.rangeQuery(finalField).gt(LocalDate.now().plusDays(30).format(formatter))), or);
} else { } else {
queryBuilder.add(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(finalField)), or); queryBuilder.add(QueryBuilders.boolQuery().mustNot(existsQuery(finalField)), or);
} }
}); });
boolMust.must(queryBuilder.build()); boolMust.must(queryBuilder.build());
...@@ -1074,11 +1075,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1074,11 +1075,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if ("1".equals(item)) { if ("1".equals(item)) {
queryBuilder.must(QueryBuilders.termsQuery("IS_INTO_MANAGEMENT", Boolean.TRUE)) queryBuilder.must(QueryBuilders.termsQuery("IS_INTO_MANAGEMENT", Boolean.TRUE))
.must(QueryBuilders.existsQuery("USE_ORG_CODE")); .must(existsQuery("USE_ORG_CODE"));
} else { } else {
queryBuilder.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("IS_INTO_MANAGEMENT"))) queryBuilder.should(QueryBuilders.boolQuery().mustNot(existsQuery("IS_INTO_MANAGEMENT")))
.should(QueryBuilders.matchQuery("IS_INTO_MANAGEMENT", Boolean.FALSE)) .should(QueryBuilders.matchQuery("IS_INTO_MANAGEMENT", Boolean.FALSE))
.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("USE_ORG_CODE"))) .should(QueryBuilders.boolQuery().mustNot(existsQuery("USE_ORG_CODE")))
.minimumShouldMatch(1); .minimumShouldMatch(1);
} }
enhancedDynamicQueryBuilder.add(queryBuilder, or); enhancedDynamicQueryBuilder.add(queryBuilder, or);
...@@ -1110,7 +1111,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1110,7 +1111,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (!item.equals("99")) { if (!item.equals("99")) {
queryBuilder.add(QueryBuilders.matchQuery(k, item.toString()), or); queryBuilder.add(QueryBuilders.matchQuery(k, item.toString()), or);
} else { } else {
queryBuilder.add(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(k)), or); queryBuilder.add(QueryBuilders.boolQuery().mustNot(existsQuery(k)), or);
} }
}); });
boolMust.must(queryBuilder.build()); boolMust.must(queryBuilder.build());
...@@ -1289,24 +1290,53 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1289,24 +1290,53 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private BigDecimal getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder, String countField) { private BigDecimal getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder, String countField) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.equip.getKey()); request.indices(StatisticalAnalysisEnum.equip.getKey());
BigDecimal pipeLong; BigDecimal pipeLong = new BigDecimal(0);
NestedQueryBuilder nestedQueryBuilder = QueryBuilders.nestedQuery("techParams", // String painlessScript =
QueryBuilders.boolQuery().must(QueryBuilders.termsQuery("techParams.paramKey", "pipeLength")), // "double total = 0.0; " +
ScoreMode.None); // "for (int i = 0; i < doc['techParams.doubleValue'].length; i++) { " +
boolMust.must(nestedQueryBuilder); // " if (doc['techParams.paramKey'][i] == 'pipeLength') { " +
builder.query(boolMust).aggregation(AggregationBuilders.nested(countField, "techParams").subAggregation( // " try { " +
AggregationBuilders.sum("pipeLength").field("techParams.doubleValue") // " total += Double.parseDouble(doc['techParams.doubleValue'][i].toString()); " +
) // " } catch (Exception e) {} " +
); // " } " +
// "} " +
// "return total;";
// NestedAggregationBuilder nestedAgg = AggregationBuilders.nested(countField, "techParams");
// SumAggregationBuilder sumAgg = AggregationBuilders.sum("pipeLength")
// .script(new Script(ScriptType.INLINE, "painless", painlessScript, Collections.emptyMap()));
// nestedAgg.subAggregation(sumAgg);
builder.query(boolMust).size(10000000);
request.source(builder); request.source(builder);
try { try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT); SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
ParsedSum sumAgg = ((ParsedNested) response.getAggregations()
.get(countField)) JSONArray resultList = new JSONArray();
.getAggregations() for (SearchHit hit : response.getHits().getHits()) {
.get("pipeLength"); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(hit);
double value = sumAgg.getValue(); JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
pipeLong = new BigDecimal(value); resultList.add(dto.get("techParams"));
}
for (Object object : resultList) {
JSONArray jsonArray = (JSONArray) object;
for (Object o : jsonArray) {
JSONObject jsonObject = (JSONObject) o;
if(jsonObject.getString("paramKey").equals("pipeLength") && jsonObject.containsKey("doubleValue")){
BigDecimal value = new BigDecimal(jsonObject.get("doubleValue").toString());
pipeLong = pipeLong.add(value);
}
}
}
// // 获取最外层聚合结果
// Aggregations aggregations = response.getAggregations();
// // 1. 获取嵌套聚合结果
// ParsedNested nestedItems = aggregations.get(countField);
// 2. 从嵌套聚合中获取过滤聚合结果
// ParsedFilter filteredItems = nestedItems.getAggregations().get("filtered_items");
// 3. 从过滤聚合中获取指标聚合结果
// ParsedSum totalValue = nestedItems.getAggregations().get("pipeLength");
// double value = 0;
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -1801,13 +1831,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1801,13 +1831,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 无许可到期日期 // 无许可到期日期
NestedQueryBuilder noneQuery = QueryBuilders.nestedQuery( NestedQueryBuilder noneQuery = QueryBuilders.nestedQuery(
path, path,
QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(nestedField)), QueryBuilders.boolQuery().mustNot(existsQuery(nestedField)),
ScoreMode.None ScoreMode.None
); );
// 有效许可到期日期 // 有效许可到期日期
NestedQueryBuilder existsQuery = QueryBuilders.nestedQuery( NestedQueryBuilder existsQuery = QueryBuilders.nestedQuery(
path, path,
QueryBuilders.boolQuery().must(QueryBuilders.existsQuery(nestedField)), QueryBuilders.boolQuery().must(existsQuery(nestedField)),
ScoreMode.None ScoreMode.None
); );
// 正常许可到期日期 // 正常许可到期日期
...@@ -3043,7 +3073,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3043,7 +3073,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (groupField.equals("EQU_LIST_CODE")) { if (groupField.equals("EQU_LIST_CODE")) {
gasBoolQueryBuilder = QueryBuilderUtils.copyBoolQuery(boolMust); gasBoolQueryBuilder = QueryBuilderUtils.copyBoolQuery(boolMust);
} }
boolMust.mustNot(QueryBuilders.matchQuery("EQU_CATEGORY_CODE", "2300")); if(!"2300".equals(equipCode)){
boolMust.mustNot(QueryBuilders.matchQuery("EQU_CATEGORY_CODE", "2300"));
}
getStatisticCountByGroup(request, builder, boolMust, groupField, staticCountByGroup, "noGas"); getStatisticCountByGroup(request, builder, boolMust, groupField, staticCountByGroup, "noGas");
AtomicReference<Long> otherCount = new AtomicReference<>(0L); AtomicReference<Long> otherCount = new AtomicReference<>(0L);
...@@ -3060,7 +3092,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3060,7 +3092,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder queryBuilder = QueryBuilderUtils.copyBoolQuery(pipeBoolMust); BoolQueryBuilder queryBuilder = QueryBuilderUtils.copyBoolQuery(pipeBoolMust);
String code = categoryMap.get("value").toString(); String code = categoryMap.get("value").toString();
codes.add(code); codes.add(code);
if (code.startsWith("2300")) { // 去除类别中的气瓶
if (code.equals("2300")) {
staticCountByGroup.remove(code); staticCountByGroup.remove(code);
continue; continue;
} }
...@@ -3079,7 +3112,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3079,7 +3112,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map.put("img", dpEquipPhotoPrefix + code + dpEquipPhotoSuffix); map.put("img", dpEquipPhotoPrefix + code + dpEquipPhotoSuffix);
Integer count = tzsCustomFilterMapper.selectEquipmentCategoryCountByParentId(categoryMap.get("key").toString()); Integer count = tzsCustomFilterMapper.selectEquipmentCategoryCountByParentId(categoryMap.get("key").toString());
map.put("noChild", 0 == count ? Boolean.TRUE : Boolean.FALSE); map.put("noChild", 0 == count ? Boolean.TRUE : Boolean.FALSE);
map.put("measurementUnit", equipCode != null && equipCode.startsWith("8") ? "千米" : equipCode != null && equipCode.startsWith("2") ? "个" : "台套"); map.put("measurementUnit", code.startsWith("8") ? "千米" : code.startsWith("2") ? "个" : "台套");
map.put("noBottom", code.startsWith("8") ? Boolean.TRUE : Boolean.FALSE); map.put("noBottom", code.startsWith("8") ? Boolean.TRUE : Boolean.FALSE);
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE // 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
...@@ -3124,7 +3157,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3124,7 +3157,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map.put("measurementUnit", "个"); map.put("measurementUnit", "个");
map.put("noBottom", Boolean.FALSE); map.put("noBottom", Boolean.FALSE);
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE // 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(gasBoolQueryBuilder);
scoreQuery.must(QueryBuilders.termQuery(fieldKey, code)); scoreQuery.must(QueryBuilders.termQuery(fieldKey, code));
SearchSourceBuilder scoreBuilder = new SearchSourceBuilder(); SearchSourceBuilder scoreBuilder = new SearchSourceBuilder();
Map<String, Object> scoreCountByGroup = new HashMap<>(); Map<String, Object> scoreCountByGroup = new HashMap<>();
...@@ -3132,7 +3165,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3132,7 +3165,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map.put("DATA_QUALITY_SCORE", scoreCountByGroup); map.put("DATA_QUALITY_SCORE", scoreCountByGroup);
// 统计该分类下红黄绿码分别的分组数量 NEXT_INSPECT_DATE // 统计该分类下红黄绿码分别的分组数量 NEXT_INSPECT_DATE
Map<String, Long> nextInspectCountByGroup = new HashMap<>(); Map<String, Long> nextInspectCountByGroup = new HashMap<>();
BoolQueryBuilder nextInspectQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder nextInspectQuery = QueryBuilderUtils.copyBoolQuery(gasBoolQueryBuilder);
nextInspectQuery.must(QueryBuilders.termQuery(fieldKey, code)); nextInspectQuery.must(QueryBuilders.termQuery(fieldKey, code));
getStatisticCountByDate(StatisticalAnalysisEnum.equip.getKey(), "NEXT_INSPECT_DATE", nextInspectQuery, nextInspectCountByGroup); getStatisticCountByDate(StatisticalAnalysisEnum.equip.getKey(), "NEXT_INSPECT_DATE", nextInspectQuery, nextInspectCountByGroup);
map.put("NEXT_INSPECT_DATE", nextInspectCountByGroup); map.put("NEXT_INSPECT_DATE", nextInspectCountByGroup);
...@@ -3196,7 +3229,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3196,7 +3229,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE // 统计该分类下的数据完整性的分组数量 DATA_QUALITY_SCORE
BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder scoreQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
if (key.equals("NA")) { if (key.equals("NA")) {
scoreQuery.mustNot(QueryBuilders.existsQuery(groupField)); scoreQuery.mustNot(existsQuery(groupField));
} else { } else {
scoreQuery.must(QueryBuilders.termQuery(groupField, key)); scoreQuery.must(QueryBuilders.termQuery(groupField, key));
} }
...@@ -3211,7 +3244,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3211,7 +3244,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
Map<String, Long> nextInspectCountByGroup = new HashMap<>(); Map<String, Long> nextInspectCountByGroup = new HashMap<>();
BoolQueryBuilder nextInspectQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder nextInspectQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
if (key.equals("NA")) { if (key.equals("NA")) {
nextInspectQuery.mustNot(QueryBuilders.existsQuery(groupField)); nextInspectQuery.mustNot(existsQuery(groupField));
} else { } else {
nextInspectQuery.must(QueryBuilders.termQuery(groupField, key)); nextInspectQuery.must(QueryBuilders.termQuery(groupField, key));
} }
...@@ -3260,7 +3293,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3260,7 +3293,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
Long normalCount = getStatisticCount(normalQuery, index); Long normalCount = getStatisticCount(normalQuery, index);
// 无日期 // 无日期
BoolQueryBuilder noFieldQuery = QueryBuilderUtils.copyBoolQuery(nextInspectQuery); BoolQueryBuilder noFieldQuery = QueryBuilderUtils.copyBoolQuery(nextInspectQuery);
noFieldQuery.mustNot(QueryBuilders.existsQuery(field)); noFieldQuery.mustNot(existsQuery(field));
Long noFieldCount = getStatisticCount(noFieldQuery, index); Long noFieldCount = getStatisticCount(noFieldQuery, index);
nextInspectCountByGroup.put("red", overdueCount); nextInspectCountByGroup.put("red", overdueCount);
nextInspectCountByGroup.put("yellow", nearCount); nextInspectCountByGroup.put("yellow", nearCount);
...@@ -3388,7 +3421,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3388,7 +3421,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder nothingBoolQuery = QueryBuilderUtils.copyBoolQuery(boolQuery); BoolQueryBuilder nothingBoolQuery = QueryBuilderUtils.copyBoolQuery(boolQuery);
NestedQueryBuilder nothingNestedQuery = QueryBuilders.nestedQuery( NestedQueryBuilder nothingNestedQuery = QueryBuilders.nestedQuery(
path, path,
QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(nestedField)), QueryBuilders.boolQuery().mustNot(existsQuery(nestedField)),
ScoreMode.None ScoreMode.None
); );
nothingBoolQuery.must(nothingNestedQuery); nothingBoolQuery.must(nothingNestedQuery);
...@@ -3487,7 +3520,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3487,7 +3520,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
searchSourceBuilder.trackTotalHits(true); searchSourceBuilder.trackTotalHits(true);
searchSourceBuilder.size(0);// 不返回任何文档,只返回聚合结果 searchSourceBuilder.size(0);// 不返回任何文档,只返回聚合结果
SearchRequest searchRequest = new SearchRequest(); SearchRequest searchRequest = new SearchRequest();
QueryBuilderUtils.buildSplitFieldAggCondition(searchSourceBuilder, itemName + ".keyword", ",", aggName, "其他"); QueryBuilderUtils.buildSplitFieldAggCondition(searchSourceBuilder, itemName + ".keyword", "", aggName, "其他");
searchSourceBuilder.query(boolQuery); searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder); searchRequest.source(searchSourceBuilder);
try { try {
...@@ -3644,7 +3677,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3644,7 +3677,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
BoolQueryBuilder nothingBoolQuery = QueryBuilderUtils.copyBoolQuery(boolQuery); BoolQueryBuilder nothingBoolQuery = QueryBuilderUtils.copyBoolQuery(boolQuery);
NestedQueryBuilder nothingNestedQuery = QueryBuilders.nestedQuery( NestedQueryBuilder nothingNestedQuery = QueryBuilders.nestedQuery(
path, path,
QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(nestedField)), QueryBuilders.boolQuery().mustNot(existsQuery(nestedField)),
ScoreMode.None ScoreMode.None
); );
nothingBoolQuery.must(nothingNestedQuery); nothingBoolQuery.must(nothingNestedQuery);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment