Skip to content

Commit 6bdad98

Browse files
committed
Merge pull request NLPchina#144 from paxnoop/elastic2.1.1
I think this need precision_threshold offset.
2 parents 92808a2 + 386f79e commit 6bdad98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ private AbstractAggregationBuilder makeCountAgg(MethodField field) {
462462

463463
// Cardinality is approximate DISTINCT.
464464
if ("DISTINCT".equals(field.getOption())) {
465-
return AggregationBuilders.cardinality(field.getAlias()).precisionThreshold(40000).field(field.getParams().get(0).value.toString());
465+
Integer precision_threshold = field.getParams().size()>1 ? (Integer)(field.getParams().get(1).value) : 40000;
466+
return AggregationBuilders.cardinality(field.getAlias()).precisionThreshold(precision_threshold).field(field.getParams().get(0).value.toString());
466467
}
467468

468469
String fieldName = field.getParams().get(0).value.toString();

0 commit comments

Comments
 (0)