File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/main/java/org/elasticsearch/search/aggregations/metrics/percentile Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1
1
package org .elasticsearch .search .aggregations .metrics .percentile ;
2
2
3
+ import org .elasticsearch .common .xcontent .XContentBuilder ;
3
4
import org .elasticsearch .search .aggregations .metrics .ValuesSourceMetricsAggregationBuilder ;
4
5
6
+ import java .io .IOException ;
7
+
5
8
/**
6
9
*
7
10
*/
8
11
public class PercentileBuilder extends ValuesSourceMetricsAggregationBuilder <PercentileBuilder > {
9
12
13
+ private double [] percentiles ;
14
+ private String executionHint ;
15
+
10
16
public PercentileBuilder (String name ) {
11
17
super (name , InternalPercentile .TYPE .name ());
12
18
}
19
+
20
+ public PercentileBuilder executionHint (String executionHint ) {
21
+ this .executionHint = executionHint ;
22
+ return this ;
23
+ }
24
+
25
+ public PercentileBuilder percentiles (double ... percentiles ) {
26
+ this .percentiles = percentiles ;
27
+ return this ;
28
+ }
29
+
30
+ @ Override
31
+ protected void internalXContent (XContentBuilder builder , Params params ) throws IOException {
32
+ super .internalXContent (builder , params );
33
+
34
+ if (percentiles != null ) {
35
+ builder .field ("percentiles" , percentiles );
36
+ }
37
+
38
+ if (executionHint != null ) {
39
+ builder .field ("execution_hint" , executionHint );
40
+ }
41
+ }
13
42
}
You can’t perform that action at this time.
0 commit comments