23
23
24
24
package co .elastic .clients .elasticsearch ._types ;
25
25
26
+ import co .elastic .clients .util .ObjectBuilder ;
27
+ import java .util .function .Function ;
28
+
26
29
/**
27
30
* Builders for {@link SortOptions} variants.
28
31
*/
@@ -38,13 +41,33 @@ public static ScoreSort.Builder score() {
38
41
return new ScoreSort .Builder ();
39
42
}
40
43
44
+ /**
45
+ * Creates a SortOptions of the {@link ScoreSort _score} {@code SortOptions}
46
+ * variant.
47
+ */
48
+ public static SortOptions score (Function <ScoreSort .Builder , ObjectBuilder <ScoreSort >> fn ) {
49
+ SortOptions .Builder builder = new SortOptions .Builder ();
50
+ builder .score (fn .apply (new ScoreSort .Builder ()).build ());
51
+ return builder .build ();
52
+ }
53
+
41
54
/**
42
55
* Creates a builder for the {@link ScoreSort _doc} {@code SortOptions} variant.
43
56
*/
44
57
public static ScoreSort .Builder doc () {
45
58
return new ScoreSort .Builder ();
46
59
}
47
60
61
+ /**
62
+ * Creates a SortOptions of the {@link ScoreSort _doc} {@code SortOptions}
63
+ * variant.
64
+ */
65
+ public static SortOptions doc (Function <ScoreSort .Builder , ObjectBuilder <ScoreSort >> fn ) {
66
+ SortOptions .Builder builder = new SortOptions .Builder ();
67
+ builder .doc (fn .apply (new ScoreSort .Builder ()).build ());
68
+ return builder .build ();
69
+ }
70
+
48
71
/**
49
72
* Creates a builder for the {@link GeoDistanceSort _geo_distance}
50
73
* {@code SortOptions} variant.
@@ -53,6 +76,16 @@ public static GeoDistanceSort.Builder geoDistance() {
53
76
return new GeoDistanceSort .Builder ();
54
77
}
55
78
79
+ /**
80
+ * Creates a SortOptions of the {@link GeoDistanceSort _geo_distance}
81
+ * {@code SortOptions} variant.
82
+ */
83
+ public static SortOptions geoDistance (Function <GeoDistanceSort .Builder , ObjectBuilder <GeoDistanceSort >> fn ) {
84
+ SortOptions .Builder builder = new SortOptions .Builder ();
85
+ builder .geoDistance (fn .apply (new GeoDistanceSort .Builder ()).build ());
86
+ return builder .build ();
87
+ }
88
+
56
89
/**
57
90
* Creates a builder for the {@link ScriptSort _script} {@code SortOptions}
58
91
* variant.
@@ -61,6 +94,16 @@ public static ScriptSort.Builder script() {
61
94
return new ScriptSort .Builder ();
62
95
}
63
96
97
+ /**
98
+ * Creates a SortOptions of the {@link ScriptSort _script} {@code SortOptions}
99
+ * variant.
100
+ */
101
+ public static SortOptions script (Function <ScriptSort .Builder , ObjectBuilder <ScriptSort >> fn ) {
102
+ SortOptions .Builder builder = new SortOptions .Builder ();
103
+ builder .script (fn .apply (new ScriptSort .Builder ()).build ());
104
+ return builder .build ();
105
+ }
106
+
64
107
/**
65
108
* Creates a builder for the {@link FieldSort field} {@code SortOptions}
66
109
* variant.
@@ -69,4 +112,14 @@ public static FieldSort.Builder field() {
69
112
return new FieldSort .Builder ();
70
113
}
71
114
115
+ /**
116
+ * Creates a SortOptions of the {@link FieldSort field} {@code SortOptions}
117
+ * variant.
118
+ */
119
+ public static SortOptions field (Function <FieldSort .Builder , ObjectBuilder <FieldSort >> fn ) {
120
+ SortOptions .Builder builder = new SortOptions .Builder ();
121
+ builder .field (fn .apply (new FieldSort .Builder ()).build ());
122
+ return builder .build ();
123
+ }
124
+
72
125
}
0 commit comments