org.elasticsearch.search.aggregations.metrics.TopHitsAggregationBuilder Java Examples

The following examples show how to use org.elasticsearch.search.aggregations.metrics.TopHitsAggregationBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AggMaker.java    From elasticsearch-sql with Apache License 2.0 5 votes vote down vote up
/**
 * TOPHITS查询
 *
 * @param field
 * @return
 */
private AbstractAggregationBuilder makeTopHitsAgg(MethodField field) {
    String alias = gettAggNameFromParamsOrAlias(field);
    TopHitsAggregationBuilder topHits = AggregationBuilders.topHits(alias);
    List<KVValue> params = field.getParams();
    String[] include = null;
    String[] exclude = null;
    for (KVValue kv : params) {
        switch (kv.key) {
            case "from":
                topHits.from((int) kv.value);
                break;
            case "size":
                topHits.size((int) kv.value);
                break;
            case "include":
                include = kv.value.toString().split(",");
                break;
            case "exclude":
                exclude = kv.value.toString().split(",");
                break;
            case "alias":
            case "nested":
            case "reverse_nested":
            case "children":
                break;
            default:
                topHits.sort(kv.key, SortOrder.valueOf(kv.value.toString().toUpperCase()));
                break;
        }
    }
    if (include != null || exclude != null) {
        topHits.fetchSource(include, exclude);
    }
    return topHits;
}
 
Example #2
Source File: BsKeyMatchCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #3
Source File: BsElevateWordCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #4
Source File: BsBoostDocumentRuleCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #5
Source File: BsAccessTokenCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #6
Source File: BsFileConfigCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #7
Source File: BsLabelTypeCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #8
Source File: BsRoleTypeCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #9
Source File: BsElevateWordToLabelCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #10
Source File: BsDataConfigCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #11
Source File: BsWebAuthenticationCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #12
Source File: BsScheduledJobCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #13
Source File: BsRelatedQueryCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #14
Source File: BsFileAuthenticationCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #15
Source File: BsJobLogCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #16
Source File: BsRelatedContentCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #17
Source File: BsWebConfigCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #18
Source File: EsAbstractConditionAggregation.java    From fess with Apache License 2.0 4 votes vote down vote up
protected TopHitsAggregationBuilder regTopHitsA(String name) {
    TopHitsAggregationBuilder builder = AggregationBuilders.topHits(name);
    regA(builder);
    return builder;
}
 
Example #19
Source File: BsBadWordCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #20
Source File: BsPathMappingCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #21
Source File: BsCrawlingInfoCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #22
Source File: BsRequestHeaderCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #23
Source File: BsCrawlingInfoParamCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #24
Source File: BsThumbnailQueueCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #25
Source File: BsDuplicateHostCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #26
Source File: BsFailureUrlCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #27
Source File: EsAbstractConditionAggregation.java    From fess with Apache License 2.0 4 votes vote down vote up
protected TopHitsAggregationBuilder regTopHitsA(String name) {
    TopHitsAggregationBuilder builder = AggregationBuilders.topHits(name);
    regA(builder);
    return builder;
}
 
Example #28
Source File: BsGroupCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #29
Source File: BsRoleCA.java    From fess with Apache License 2.0 4 votes vote down vote up
public void topHits(String name, ConditionOptionCall<TopHitsAggregationBuilder> opLambda) {
    TopHitsAggregationBuilder builder = regTopHitsA(name);
    if (opLambda != null) {
        opLambda.callback(builder);
    }
}
 
Example #30
Source File: EsAbstractConditionAggregation.java    From fess with Apache License 2.0 4 votes vote down vote up
protected TopHitsAggregationBuilder regTopHitsA(String name) {
    TopHitsAggregationBuilder builder = AggregationBuilders.topHits(name);
    regA(builder);
    return builder;
}