28
28
import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheRequest ;
29
29
import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheResponse ;
30
30
import org .elasticsearch .action .admin .indices .close .CloseIndexRequest ;
31
- import org .elasticsearch .action .admin .indices .create .CreateIndexRequest ;
32
- import org .elasticsearch .action .admin .indices .create .CreateIndexResponse ;
33
31
import org .elasticsearch .action .admin .indices .delete .DeleteIndexRequest ;
34
32
import org .elasticsearch .action .admin .indices .flush .FlushRequest ;
35
33
import org .elasticsearch .action .admin .indices .flush .FlushResponse ;
60
58
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
61
59
import org .elasticsearch .action .support .master .AcknowledgedResponse ;
62
60
import org .elasticsearch .client .core .ShardsAcknowledgedResponse ;
61
+ import org .elasticsearch .client .indices .CreateIndexRequest ;
62
+ import org .elasticsearch .client .indices .CreateIndexResponse ;
63
63
import org .elasticsearch .client .indices .FreezeIndexRequest ;
64
64
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
65
65
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
@@ -147,24 +147,52 @@ public void deleteAsync(DeleteIndexRequest deleteIndexRequest, ActionListener<Ac
147
147
* @return the response
148
148
* @throws IOException in case there is a problem sending the request or parsing back the response
149
149
*/
150
- public CreateIndexResponse create (CreateIndexRequest createIndexRequest , RequestOptions options ) throws IOException {
150
+ public CreateIndexResponse create (CreateIndexRequest createIndexRequest ,
151
+ RequestOptions options ) throws IOException {
151
152
return restHighLevelClient .performRequestAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex , options ,
152
- CreateIndexResponse ::fromXContent , emptySet ());
153
+ CreateIndexResponse ::fromXContent , emptySet ());
153
154
}
154
155
155
156
/**
156
157
* Creates an index using the Create Index API.
157
158
* <p>
158
159
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
159
160
* Create Index API on elastic.co</a>
160
- * @deprecated Prefer {@link #create(CreateIndexRequest, RequestOptions)}
161
+ *
162
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
163
+ * method {@link #create(CreateIndexRequest, RequestOptions)} should be used instead, which accepts a new
164
+ * request object and also uses request options instead of headers.
161
165
*/
162
166
@ Deprecated
163
- public CreateIndexResponse create (CreateIndexRequest createIndexRequest , Header ... headers ) throws IOException {
167
+ public CreateIndexResponse create (
168
+ org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
169
+ Header ... headers ) throws IOException {
164
170
return restHighLevelClient .performRequestAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex ,
165
171
CreateIndexResponse ::fromXContent , emptySet (), headers );
166
172
}
167
173
174
+ /**
175
+ * Creates an index using the Create Index API.
176
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
177
+ * Create Index API on elastic.co</a>
178
+ * @param createIndexRequest the request
179
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
180
+ * @return the response
181
+ * @throws IOException in case there is a problem sending the request or parsing back the response
182
+ *
183
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
184
+ * method {@link #create(CreateIndexRequest, RequestOptions)} should be used instead, which accepts a new
185
+ * request object.
186
+ */
187
+ @ Deprecated
188
+ public org .elasticsearch .action .admin .indices .create .CreateIndexResponse create (
189
+ org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
190
+ RequestOptions options ) throws IOException {
191
+ return restHighLevelClient .performRequestAndParseEntity (createIndexRequest ,
192
+ IndicesRequestConverters ::createIndex , options ,
193
+ org .elasticsearch .action .admin .indices .create .CreateIndexResponse ::fromXContent , emptySet ());
194
+ }
195
+
168
196
/**
169
197
* Asynchronously creates an index using the Create Index API.
170
198
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
@@ -173,20 +201,47 @@ public CreateIndexResponse create(CreateIndexRequest createIndexRequest, Header.
173
201
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
174
202
* @param listener the listener to be notified upon request completion
175
203
*/
176
- public void createAsync (CreateIndexRequest createIndexRequest , RequestOptions options , ActionListener <CreateIndexResponse > listener ) {
204
+ public void createAsync (CreateIndexRequest createIndexRequest ,
205
+ RequestOptions options ,
206
+ ActionListener <CreateIndexResponse > listener ) {
177
207
restHighLevelClient .performRequestAsyncAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex , options ,
178
- CreateIndexResponse ::fromXContent , listener , emptySet ());
208
+ CreateIndexResponse ::fromXContent , listener , emptySet ());
209
+ }
210
+
211
+ /**
212
+ * Asynchronously creates an index using the Create Index API.
213
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
214
+ * Create Index API on elastic.co</a>
215
+ * @param createIndexRequest the request
216
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
217
+ * @param listener the listener to be notified upon request completion
218
+ *
219
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
220
+ * method {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)} should be used instead,
221
+ * which accepts a new request object.
222
+ */
223
+ @ Deprecated
224
+ public void createAsync (org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
225
+ RequestOptions options ,
226
+ ActionListener <org .elasticsearch .action .admin .indices .create .CreateIndexResponse > listener ) {
227
+ restHighLevelClient .performRequestAsyncAndParseEntity (createIndexRequest ,
228
+ IndicesRequestConverters ::createIndex , options ,
229
+ org .elasticsearch .action .admin .indices .create .CreateIndexResponse ::fromXContent , listener , emptySet ());
179
230
}
180
231
181
232
/**
182
233
* Asynchronously creates an index using the Create Index API.
183
234
* <p>
184
235
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
185
236
* Create Index API on elastic.co</a>
186
- * @deprecated Prefer {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)}
237
+ *
238
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
239
+ * method {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)} should be used instead,
240
+ * which accepts a new request object and also uses request objects instead of headers.
187
241
*/
188
242
@ Deprecated
189
- public void createAsync (CreateIndexRequest createIndexRequest , ActionListener <CreateIndexResponse > listener , Header ... headers ) {
243
+ public void createAsync (org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
244
+ ActionListener <CreateIndexResponse > listener , Header ... headers ) {
190
245
restHighLevelClient .performRequestAsyncAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex ,
191
246
CreateIndexResponse ::fromXContent , listener , emptySet (), headers );
192
247
}
0 commit comments