15
15
*/
16
16
package org .springframework .data .elasticsearch .core .query ;
17
17
18
- import static org .springframework .data .elasticsearch .core .sql .types .ResponseFormat .cbor ;
19
- import static org .springframework .data .elasticsearch .core .sql .types .ResponseFormat .csv ;
20
- import static org .springframework .data .elasticsearch .core .sql .types .ResponseFormat .json ;
21
- import static org .springframework .data .elasticsearch .core .sql .types .ResponseFormat .smile ;
22
- import static org .springframework .data .elasticsearch .core .sql .types .ResponseFormat .yaml ;
23
-
24
18
import java .time .Duration ;
25
19
import java .util .ArrayList ;
26
20
import java .util .List ;
27
21
import java .util .TimeZone ;
28
22
29
- import org .springframework .data .elasticsearch .core .sql .types .ResponseFormat ;
30
23
import org .springframework .lang .Nullable ;
31
24
import org .springframework .util .Assert ;
32
25
38
31
* @since 5.4
39
32
*/
40
33
public class SqlQuery {
41
- /**
42
- * Separator for CSV results.
43
- * <p>
44
- * Default, this is set to {@code ,}.
45
- */
46
- @ Nullable private final String delimiter ;
47
-
48
- /**
49
- * The format for the response, such as csv, json, txt, can be viewed at the {@link ResponseFormat}. The java client
50
- * of Elasticsearch only supports JSON. See {@link co.elastic.clients.transport.JsonEndpoint}
51
- * <p>
52
- * Default, this is set to {@code json}.
53
- */
54
- @ Nullable private final ResponseFormat format ;
55
34
56
35
/**
57
36
* If true, returns partial results if there are shard request timeouts or shard failures.
@@ -157,9 +136,6 @@ public class SqlQuery {
157
136
@ Nullable private final Duration waitForCompletionTimeout ;
158
137
159
138
private SqlQuery (Builder builder ) {
160
- this .delimiter = builder .delimiter ;
161
- this .format = builder .format ;
162
-
163
139
this .allowPartialSearchResults = builder .allowPartialSearchResults ;
164
140
165
141
this .catalog = builder .catalog ;
@@ -185,16 +161,6 @@ private SqlQuery(Builder builder) {
185
161
this .waitForCompletionTimeout = builder .waitForCompletionTimeout ;
186
162
}
187
163
188
- @ Nullable
189
- public String getDelimiter () {
190
- return delimiter ;
191
- }
192
-
193
- @ Nullable
194
- public ResponseFormat getFormat () {
195
- return format ;
196
- }
197
-
198
164
@ Nullable
199
165
public Boolean getAllowPartialSearchResults () {
200
166
return allowPartialSearchResults ;
@@ -279,9 +245,6 @@ public static Builder builder(String query) {
279
245
}
280
246
281
247
public static class Builder {
282
- @ Nullable private String delimiter ;
283
- @ Nullable private ResponseFormat format ;
284
-
285
248
@ Nullable private Boolean allowPartialSearchResults ;
286
249
287
250
@ Nullable private String catalog ;
@@ -313,24 +276,6 @@ private Builder(String query) {
313
276
this .query = query ;
314
277
}
315
278
316
- /**
317
- * Separator for CSV results.
318
- */
319
- public Builder withDelimiter (String delimiter ) {
320
- this .delimiter = delimiter ;
321
-
322
- return this ;
323
- }
324
-
325
- /**
326
- * The format for the response, such as csv, json, txt, can be viewed at the {@link ResponseFormat}.
327
- */
328
- public Builder withFormat (ResponseFormat format ) {
329
- this .format = format ;
330
-
331
- return this ;
332
- }
333
-
334
279
/**
335
280
* If true, returns partial results if there are shard request timeouts or shard failures.
336
281
*/
@@ -482,16 +427,6 @@ public Builder withWaitForCompletionTimeout(Duration waitForCompletionTimeout) {
482
427
}
483
428
484
429
public SqlQuery build () {
485
- if (Boolean .TRUE .equals (columnar )) {
486
- if (!(cbor .equals (format ) || json .equals (format ) || smile .equals (format ) || yaml .equals (format ))) {
487
- throw new IllegalArgumentException ("Columnar format support only YAML, CBOR, JSON and SMILE." );
488
- }
489
- }
490
-
491
- if (delimiter != null && !csv .equals (format )) {
492
- throw new IllegalArgumentException ("Delimiter support is only available for CSV responses." );
493
- }
494
-
495
430
return new SqlQuery (this );
496
431
}
497
432
}
0 commit comments