Skip to content

Commit 0eaa9bb

Browse files
authored
Merge branch 'main' into add.documentation
2 parents 6ae3149 + 948c23b commit 0eaa9bb

File tree

302 files changed

+20550
-19939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+20550
-19939
lines changed

java-client/src/main/java/co/elastic/clients/base/rest_client/RestClientTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import co.elastic.clients.base.BooleanEndpoint;
2323
import co.elastic.clients.base.BooleanResponse;
2424
import co.elastic.clients.base.ElasticsearchCatRequest;
25-
import co.elastic.clients.elasticsearch.ElasticsearchException;
25+
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
2626
import co.elastic.clients.base.Endpoint;
2727
import co.elastic.clients.base.Transport;
2828
import co.elastic.clients.elasticsearch._types.ErrorResponse;

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java

Lines changed: 192 additions & 187 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java

Lines changed: 174 additions & 187 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchException.java renamed to java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchException.java

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,44 @@
1717
* under the License.
1818
*/
1919

20-
package co.elastic.clients.elasticsearch;
21-
22-
import co.elastic.clients.elasticsearch._types.ErrorCause;
23-
import co.elastic.clients.elasticsearch._types.ErrorResponse;
20+
package co.elastic.clients.elasticsearch._types;
2421

2522
/**
26-
* Exception thrown by API client methods when Elasticsearch could not accept or process a request.
23+
* Exception thrown by API client methods when Elasticsearch could not accept or
24+
* process a request.
2725
* <p>
28-
* The {@link #error()} contains the error's type and reason along with additional details that depend on the error type and
29-
* the API endpoint that was called.
26+
* The {@link #error()} contains the error's type and reason along with
27+
* additional details that depend on the error type and the API endpoint that
28+
* was called.
3029
*/
3130
public class ElasticsearchException extends RuntimeException {
3231

33-
private final ErrorResponse response;
34-
35-
public ElasticsearchException(ErrorResponse response) {
36-
super(response.error().reason());
37-
this.response = response;
38-
}
39-
40-
/**
41-
* The error response sent by Elasticsearch
42-
*/
43-
public ErrorResponse response() {
44-
return this.response;
45-
}
46-
47-
/**
48-
* The cause of the error. Shortcut for {@code response().error()}.
49-
*/
50-
public ErrorCause error() {
51-
return this.response.error();
52-
}
53-
54-
/**
55-
* Status code returned by Elasticsearch. Shortcut for {@code response().status()}.
56-
*/
57-
public int status() {
58-
return this.response.status();
59-
}
32+
private final ErrorResponse response;
33+
34+
public ElasticsearchException(ErrorResponse response) {
35+
super(response.error().reason());
36+
this.response = response;
37+
}
38+
39+
/**
40+
* The error response sent by Elasticsearch
41+
*/
42+
public ErrorResponse response() {
43+
return this.response;
44+
}
45+
46+
/**
47+
* The cause of the error. Shortcut for {@code response().error()}.
48+
*/
49+
public ErrorCause error() {
50+
return this.response.error();
51+
}
52+
53+
/**
54+
* Status code returned by Elasticsearch. Shortcut for
55+
* {@code response().status()}.
56+
*/
57+
public int status() {
58+
return this.response.status();
59+
}
6060
}

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SuggestMode.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchAsyncClient.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import co.elastic.clients.base.ApiClient;
2727
import co.elastic.clients.base.Transport;
28-
import co.elastic.clients.elasticsearch.ElasticsearchException;
28+
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
2929
import co.elastic.clients.util.ObjectBuilder;
3030
import java.io.IOException;
3131
import java.util.concurrent.CompletableFuture;
@@ -52,7 +52,8 @@ public ElasticsearchAsyncSearchAsyncClient(Transport transport) {
5252
* on elastic.co</a>
5353
*/
5454

55-
public CompletableFuture<DeleteAsyncSearchResponse> delete(DeleteAsyncSearchRequest request) throws IOException {
55+
public CompletableFuture<DeleteAsyncSearchResponse> delete(DeleteAsyncSearchRequest request)
56+
throws IOException, ElasticsearchException {
5657
return this.transport.performRequestAsync(request, DeleteAsyncSearchRequest.ENDPOINT);
5758
}
5859

@@ -61,16 +62,16 @@ public CompletableFuture<DeleteAsyncSearchResponse> delete(DeleteAsyncSearchRequ
6162
* request will be cancelled. Otherwise, the saved search results are deleted.
6263
*
6364
* @param fn
64-
* a function that initializes a freshly created builder. This
65-
* function can either return its builder argument after having set
66-
* its properties or return another builder.
65+
* a function that initializes a builder to create the
66+
* {@link DeleteAsyncSearchRequest}
6767
* @see <a href=
6868
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
6969
* on elastic.co</a>
7070
*/
7171

7272
public final CompletableFuture<DeleteAsyncSearchResponse> delete(
73-
Function<DeleteAsyncSearchRequest.Builder, ObjectBuilder<DeleteAsyncSearchRequest>> fn) throws IOException {
73+
Function<DeleteAsyncSearchRequest.Builder, ObjectBuilder<DeleteAsyncSearchRequest>> fn)
74+
throws IOException, ElasticsearchException {
7475
return delete(fn.apply(new DeleteAsyncSearchRequest.Builder()).build());
7576
}
7677

@@ -86,7 +87,7 @@ public final CompletableFuture<DeleteAsyncSearchResponse> delete(
8687
*/
8788

8889
public <TDocument> CompletableFuture<GetAsyncSearchResponse<TDocument>> get(GetAsyncSearchRequest request,
89-
Class<TDocument> tDocumentClass) throws IOException {
90+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
9091
return this.transport.performRequestAsync(request,
9192
GetAsyncSearchRequest.createGetEndpoint(getDeserializer(tDocumentClass)));
9293
}
@@ -96,17 +97,16 @@ public <TDocument> CompletableFuture<GetAsyncSearchResponse<TDocument>> get(GetA
9697
* its ID.
9798
*
9899
* @param fn
99-
* a function that initializes a freshly created builder. This
100-
* function can either return its builder argument after having set
101-
* its properties or return another builder.
100+
* a function that initializes a builder to create the
101+
* {@link GetAsyncSearchRequest}
102102
* @see <a href=
103103
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
104104
* on elastic.co</a>
105105
*/
106106

107107
public final <TDocument> CompletableFuture<GetAsyncSearchResponse<TDocument>> get(
108108
Function<GetAsyncSearchRequest.Builder, ObjectBuilder<GetAsyncSearchRequest>> fn,
109-
Class<TDocument> tDocumentClass) throws IOException {
109+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
110110
return get(fn.apply(new GetAsyncSearchRequest.Builder()).build(), tDocumentClass);
111111
}
112112

@@ -122,7 +122,7 @@ public final <TDocument> CompletableFuture<GetAsyncSearchResponse<TDocument>> ge
122122
*/
123123

124124
public <TDocument> CompletableFuture<StatusResponse<TDocument>> status(StatusRequest request,
125-
Class<TDocument> tDocumentClass) throws IOException {
125+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
126126
return this.transport.performRequestAsync(request,
127127
StatusRequest.createStatusEndpoint(getDeserializer(tDocumentClass)));
128128
}
@@ -132,17 +132,16 @@ public <TDocument> CompletableFuture<StatusResponse<TDocument>> status(StatusReq
132132
* ID.
133133
*
134134
* @param fn
135-
* a function that initializes a freshly created builder. This
136-
* function can either return its builder argument after having set
137-
* its properties or return another builder.
135+
* a function that initializes a builder to create the
136+
* {@link StatusRequest}
138137
* @see <a href=
139138
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
140139
* on elastic.co</a>
141140
*/
142141

143142
public final <TDocument> CompletableFuture<StatusResponse<TDocument>> status(
144143
Function<StatusRequest.Builder, ObjectBuilder<StatusRequest>> fn, Class<TDocument> tDocumentClass)
145-
throws IOException {
144+
throws IOException, ElasticsearchException {
146145
return status(fn.apply(new StatusRequest.Builder()).build(), tDocumentClass);
147146
}
148147

@@ -157,7 +156,7 @@ public final <TDocument> CompletableFuture<StatusResponse<TDocument>> status(
157156
*/
158157

159158
public <TDocument> CompletableFuture<SubmitResponse<TDocument>> submit(SubmitRequest request,
160-
Class<TDocument> tDocumentClass) throws IOException {
159+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
161160
return this.transport.performRequestAsync(request,
162161
SubmitRequest.createSubmitEndpoint(getDeserializer(tDocumentClass)));
163162
}
@@ -166,17 +165,16 @@ public <TDocument> CompletableFuture<SubmitResponse<TDocument>> submit(SubmitReq
166165
* Executes a search request asynchronously.
167166
*
168167
* @param fn
169-
* a function that initializes a freshly created builder. This
170-
* function can either return its builder argument after having set
171-
* its properties or return another builder.
168+
* a function that initializes a builder to create the
169+
* {@link SubmitRequest}
172170
* @see <a href=
173171
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
174172
* on elastic.co</a>
175173
*/
176174

177175
public final <TDocument> CompletableFuture<SubmitResponse<TDocument>> submit(
178176
Function<SubmitRequest.Builder, ObjectBuilder<SubmitRequest>> fn, Class<TDocument> tDocumentClass)
179-
throws IOException {
177+
throws IOException, ElasticsearchException {
180178
return submit(fn.apply(new SubmitRequest.Builder()).build(), tDocumentClass);
181179
}
182180

java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchClient.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import co.elastic.clients.base.ApiClient;
2727
import co.elastic.clients.base.Transport;
28-
import co.elastic.clients.elasticsearch.ElasticsearchException;
28+
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
2929
import co.elastic.clients.util.ObjectBuilder;
3030
import java.io.IOException;
3131
import java.util.function.Function;
@@ -51,7 +51,8 @@ public ElasticsearchAsyncSearchClient(Transport transport) {
5151
* on elastic.co</a>
5252
*/
5353

54-
public DeleteAsyncSearchResponse delete(DeleteAsyncSearchRequest request) throws IOException {
54+
public DeleteAsyncSearchResponse delete(DeleteAsyncSearchRequest request)
55+
throws IOException, ElasticsearchException {
5556
return this.transport.performRequest(request, DeleteAsyncSearchRequest.ENDPOINT);
5657
}
5758

@@ -60,16 +61,16 @@ public DeleteAsyncSearchResponse delete(DeleteAsyncSearchRequest request) throws
6061
* request will be cancelled. Otherwise, the saved search results are deleted.
6162
*
6263
* @param fn
63-
* a function that initializes a freshly created builder. This
64-
* function can either return its builder argument after having set
65-
* its properties or return another builder.
64+
* a function that initializes a builder to create the
65+
* {@link DeleteAsyncSearchRequest}
6666
* @see <a href=
6767
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
6868
* on elastic.co</a>
6969
*/
7070

7171
public final DeleteAsyncSearchResponse delete(
72-
Function<DeleteAsyncSearchRequest.Builder, ObjectBuilder<DeleteAsyncSearchRequest>> fn) throws IOException {
72+
Function<DeleteAsyncSearchRequest.Builder, ObjectBuilder<DeleteAsyncSearchRequest>> fn)
73+
throws IOException, ElasticsearchException {
7374
return delete(fn.apply(new DeleteAsyncSearchRequest.Builder()).build());
7475
}
7576

@@ -85,7 +86,7 @@ public final DeleteAsyncSearchResponse delete(
8586
*/
8687

8788
public <TDocument> GetAsyncSearchResponse<TDocument> get(GetAsyncSearchRequest request,
88-
Class<TDocument> tDocumentClass) throws IOException {
89+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
8990
return this.transport.performRequest(request,
9091
GetAsyncSearchRequest.createGetEndpoint(getDeserializer(tDocumentClass)));
9192
}
@@ -95,17 +96,16 @@ public <TDocument> GetAsyncSearchResponse<TDocument> get(GetAsyncSearchRequest r
9596
* its ID.
9697
*
9798
* @param fn
98-
* a function that initializes a freshly created builder. This
99-
* function can either return its builder argument after having set
100-
* its properties or return another builder.
99+
* a function that initializes a builder to create the
100+
* {@link GetAsyncSearchRequest}
101101
* @see <a href=
102102
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
103103
* on elastic.co</a>
104104
*/
105105

106106
public final <TDocument> GetAsyncSearchResponse<TDocument> get(
107107
Function<GetAsyncSearchRequest.Builder, ObjectBuilder<GetAsyncSearchRequest>> fn,
108-
Class<TDocument> tDocumentClass) throws IOException {
108+
Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException {
109109
return get(fn.apply(new GetAsyncSearchRequest.Builder()).build(), tDocumentClass);
110110
}
111111

@@ -121,7 +121,7 @@ public final <TDocument> GetAsyncSearchResponse<TDocument> get(
121121
*/
122122

123123
public <TDocument> StatusResponse<TDocument> status(StatusRequest request, Class<TDocument> tDocumentClass)
124-
throws IOException {
124+
throws IOException, ElasticsearchException {
125125
return this.transport.performRequest(request,
126126
StatusRequest.createStatusEndpoint(getDeserializer(tDocumentClass)));
127127
}
@@ -131,17 +131,16 @@ public <TDocument> StatusResponse<TDocument> status(StatusRequest request, Class
131131
* ID.
132132
*
133133
* @param fn
134-
* a function that initializes a freshly created builder. This
135-
* function can either return its builder argument after having set
136-
* its properties or return another builder.
134+
* a function that initializes a builder to create the
135+
* {@link StatusRequest}
137136
* @see <a href=
138137
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
139138
* on elastic.co</a>
140139
*/
141140

142141
public final <TDocument> StatusResponse<TDocument> status(
143142
Function<StatusRequest.Builder, ObjectBuilder<StatusRequest>> fn, Class<TDocument> tDocumentClass)
144-
throws IOException {
143+
throws IOException, ElasticsearchException {
145144
return status(fn.apply(new StatusRequest.Builder()).build(), tDocumentClass);
146145
}
147146

@@ -156,7 +155,7 @@ public final <TDocument> StatusResponse<TDocument> status(
156155
*/
157156

158157
public <TDocument> SubmitResponse<TDocument> submit(SubmitRequest request, Class<TDocument> tDocumentClass)
159-
throws IOException {
158+
throws IOException, ElasticsearchException {
160159
return this.transport.performRequest(request,
161160
SubmitRequest.createSubmitEndpoint(getDeserializer(tDocumentClass)));
162161
}
@@ -165,17 +164,16 @@ public <TDocument> SubmitResponse<TDocument> submit(SubmitRequest request, Class
165164
* Executes a search request asynchronously.
166165
*
167166
* @param fn
168-
* a function that initializes a freshly created builder. This
169-
* function can either return its builder argument after having set
170-
* its properties or return another builder.
167+
* a function that initializes a builder to create the
168+
* {@link SubmitRequest}
171169
* @see <a href=
172170
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">Documentation
173171
* on elastic.co</a>
174172
*/
175173

176174
public final <TDocument> SubmitResponse<TDocument> submit(
177175
Function<SubmitRequest.Builder, ObjectBuilder<SubmitRequest>> fn, Class<TDocument> tDocumentClass)
178-
throws IOException {
176+
throws IOException, ElasticsearchException {
179177
return submit(fn.apply(new SubmitRequest.Builder()).build(), tDocumentClass);
180178
}
181179

0 commit comments

Comments
 (0)