2727import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheRequest ;
2828import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheResponse ;
2929import org .elasticsearch .action .admin .indices .close .CloseIndexRequest ;
30- import org .elasticsearch .action .admin .indices .create .CreateIndexRequest ;
31- import org .elasticsearch .action .admin .indices .create .CreateIndexResponse ;
3230import org .elasticsearch .action .admin .indices .delete .DeleteIndexRequest ;
3331import org .elasticsearch .action .admin .indices .flush .FlushRequest ;
3432import org .elasticsearch .action .admin .indices .flush .FlushResponse ;
5957import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
6058import org .elasticsearch .action .support .master .AcknowledgedResponse ;
6159import org .elasticsearch .client .core .ShardsAcknowledgedResponse ;
60+ import org .elasticsearch .client .indices .CreateIndexRequest ;
61+ import org .elasticsearch .client .indices .CreateIndexResponse ;
6262import org .elasticsearch .client .indices .FreezeIndexRequest ;
6363import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
6464import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
@@ -120,9 +120,10 @@ public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions op
120120 * @return the response
121121 * @throws IOException in case there is a problem sending the request or parsing back the response
122122 */
123- public CreateIndexResponse create (CreateIndexRequest createIndexRequest , RequestOptions options ) throws IOException {
123+ public CreateIndexResponse create (CreateIndexRequest createIndexRequest ,
124+ RequestOptions options ) throws IOException {
124125 return restHighLevelClient .performRequestAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex , options ,
125- CreateIndexResponse ::fromXContent , emptySet ());
126+ CreateIndexResponse ::fromXContent , emptySet ());
126127 }
127128
128129 /**
@@ -133,9 +134,54 @@ public CreateIndexResponse create(CreateIndexRequest createIndexRequest, Request
133134 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
134135 * @param listener the listener to be notified upon request completion
135136 */
136- public void createAsync (CreateIndexRequest createIndexRequest , RequestOptions options , ActionListener <CreateIndexResponse > listener ) {
137+ public void createAsync (CreateIndexRequest createIndexRequest ,
138+ RequestOptions options ,
139+ ActionListener <CreateIndexResponse > listener ) {
137140 restHighLevelClient .performRequestAsyncAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex , options ,
138- CreateIndexResponse ::fromXContent , listener , emptySet ());
141+ CreateIndexResponse ::fromXContent , listener , emptySet ());
142+ }
143+
144+ /**
145+ * Creates an index using the Create Index API.
146+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
147+ * Create Index API on elastic.co</a>
148+ * @param createIndexRequest the request
149+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
150+ * @return the response
151+ * @throws IOException in case there is a problem sending the request or parsing back the response
152+ *
153+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
154+ * method {@link #create(CreateIndexRequest, RequestOptions)} should be used instead, which accepts a new
155+ * request object.
156+ */
157+ @ Deprecated
158+ public org .elasticsearch .action .admin .indices .create .CreateIndexResponse create (
159+ org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
160+ RequestOptions options ) throws IOException {
161+ return restHighLevelClient .performRequestAndParseEntity (createIndexRequest ,
162+ IndicesRequestConverters ::createIndex , options ,
163+ org .elasticsearch .action .admin .indices .create .CreateIndexResponse ::fromXContent , emptySet ());
164+ }
165+
166+ /**
167+ * Asynchronously creates an index using the Create Index API.
168+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html">
169+ * Create Index API on elastic.co</a>
170+ * @param createIndexRequest the request
171+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
172+ * @param listener the listener to be notified upon request completion
173+ *
174+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
175+ * method {@link #createAsync(CreateIndexRequest, RequestOptions, ActionListener)} should be used instead,
176+ * which accepts a new request object.
177+ */
178+ @ Deprecated
179+ public void createAsync (org .elasticsearch .action .admin .indices .create .CreateIndexRequest createIndexRequest ,
180+ RequestOptions options ,
181+ ActionListener <org .elasticsearch .action .admin .indices .create .CreateIndexResponse > listener ) {
182+ restHighLevelClient .performRequestAsyncAndParseEntity (createIndexRequest ,
183+ IndicesRequestConverters ::createIndex , options ,
184+ org .elasticsearch .action .admin .indices .create .CreateIndexResponse ::fromXContent , listener , emptySet ());
139185 }
140186
141187 /**
0 commit comments