27
27
import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheRequest ;
28
28
import org .elasticsearch .action .admin .indices .cache .clear .ClearIndicesCacheResponse ;
29
29
import 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 ;
32
30
import org .elasticsearch .action .admin .indices .delete .DeleteIndexRequest ;
33
31
import org .elasticsearch .action .admin .indices .flush .FlushRequest ;
34
32
import org .elasticsearch .action .admin .indices .flush .FlushResponse ;
59
57
import org .elasticsearch .action .admin .indices .validate .query .ValidateQueryResponse ;
60
58
import org .elasticsearch .action .support .master .AcknowledgedResponse ;
61
59
import org .elasticsearch .client .core .ShardsAcknowledgedResponse ;
60
+ import org .elasticsearch .client .indices .CreateIndexRequest ;
61
+ import org .elasticsearch .client .indices .CreateIndexResponse ;
62
62
import org .elasticsearch .client .indices .FreezeIndexRequest ;
63
63
import org .elasticsearch .client .indices .GetIndexTemplatesRequest ;
64
64
import org .elasticsearch .client .indices .IndexTemplatesExistRequest ;
@@ -120,9 +120,10 @@ public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions op
120
120
* @return the response
121
121
* @throws IOException in case there is a problem sending the request or parsing back the response
122
122
*/
123
- public CreateIndexResponse create (CreateIndexRequest createIndexRequest , RequestOptions options ) throws IOException {
123
+ public CreateIndexResponse create (CreateIndexRequest createIndexRequest ,
124
+ RequestOptions options ) throws IOException {
124
125
return restHighLevelClient .performRequestAndParseEntity (createIndexRequest , IndicesRequestConverters ::createIndex , options ,
125
- CreateIndexResponse ::fromXContent , emptySet ());
126
+ CreateIndexResponse ::fromXContent , emptySet ());
126
127
}
127
128
128
129
/**
@@ -133,9 +134,54 @@ public CreateIndexResponse create(CreateIndexRequest createIndexRequest, Request
133
134
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
134
135
* @param listener the listener to be notified upon request completion
135
136
*/
136
- public void createAsync (CreateIndexRequest createIndexRequest , RequestOptions options , ActionListener <CreateIndexResponse > listener ) {
137
+ public void createAsync (CreateIndexRequest createIndexRequest ,
138
+ RequestOptions options ,
139
+ ActionListener <CreateIndexResponse > listener ) {
137
140
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 ());
139
185
}
140
186
141
187
/**
0 commit comments