コード例 #1
0
 private AggregationBuilder<?> updateAggIfNested(AggregationBuilder<?> lastAgg, Field field) {
   if (field.isNested()) {
     lastAgg =
         AggregationBuilders.nested(field.getName() + "Nested")
             .path(field.getNestedPath())
             .subAggregation(lastAgg);
   }
   return lastAgg;
 }
コード例 #2
0
 private AggregationBuilder createNestedAggregation(Field field) {
   AggregationBuilder nestedBuilder;
   String nestedPath = field.getNestedPath();
   if (field.isReverseNested()) {
     if (nestedPath == null || !nestedPath.startsWith("~"))
       return AggregationBuilders.reverseNested(getNestedAggName(field)).path(nestedPath);
     nestedPath = nestedPath.substring(1);
   }
   nestedBuilder = AggregationBuilders.nested(getNestedAggName(field)).path(nestedPath);
   return nestedBuilder;
 }
コード例 #3
0
 private String getNestedAggName(Field field) {
   String prefix;
   if (field instanceof MethodField) {
     String nestedPath = field.getNestedPath();
     if (nestedPath != null) {
       prefix = nestedPath;
     } else {
       prefix = field.getAlias();
     }
   } else {
     prefix = field.getName();
   }
   return prefix + "@NESTED";
 }