37
37
import org .elasticsearch .action .admin .indices .forcemerge .ForceMergeResponse ;
38
38
import org .elasticsearch .action .admin .indices .get .GetIndexRequest ;
39
39
import org .elasticsearch .action .admin .indices .get .GetIndexResponse ;
40
- import org .elasticsearch .action . admin . indices . mapping . get .GetFieldMappingsRequest ;
41
- import org .elasticsearch .action . admin . indices . mapping . get .GetFieldMappingsResponse ;
40
+ import org .elasticsearch .client . indices .GetFieldMappingsRequest ;
41
+ import org .elasticsearch .client . indices .GetFieldMappingsResponse ;
42
42
import org .elasticsearch .action .admin .indices .mapping .get .GetMappingsRequest ;
43
43
import org .elasticsearch .action .admin .indices .mapping .get .GetMappingsResponse ;
44
44
import org .elasticsearch .action .admin .indices .open .OpenIndexRequest ;
@@ -241,11 +241,16 @@ public void getMappingAsync(GetMappingsRequest getMappingsRequest, RequestOption
241
241
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
242
242
* @return the response
243
243
* @throws IOException in case there is a problem sending the request or parsing back the response
244
+ *
245
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The method
246
+ * {@link #getFieldMapping(GetFieldMappingsRequest, RequestOptions)} should be used instead, which accepts a new request object.
244
247
*/
245
- public GetFieldMappingsResponse getFieldMapping (GetFieldMappingsRequest getFieldMappingsRequest ,
246
- RequestOptions options ) throws IOException {
247
- return restHighLevelClient .performRequestAndParseEntity (getFieldMappingsRequest , IndicesRequestConverters ::getFieldMapping , options ,
248
- GetFieldMappingsResponse ::fromXContent , emptySet ());
248
+ @ Deprecated
249
+ public org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsResponse getFieldMapping (
250
+ org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsRequest getFieldMappingsRequest ,
251
+ RequestOptions options ) throws IOException {
252
+ return restHighLevelClient .performRequestAndParseEntity (getFieldMappingsRequest , IndicesRequestConverters ::getFieldMapping ,
253
+ options , org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsResponse ::fromXContent , emptySet ());
249
254
}
250
255
251
256
/**
@@ -255,9 +260,45 @@ public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getField
255
260
* @param getFieldMappingsRequest the request
256
261
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
257
262
* @param listener the listener to be notified upon request completion
263
+ *
264
+ * @deprecated This method uses an old request object which still refers to types, a deprecated feature. The
265
+ * method {@link #getFieldMappingAsync(GetFieldMappingsRequest, RequestOptions, ActionListener)} should be used instead,
266
+ * which accepts a new request object.
267
+ */
268
+ @ Deprecated
269
+ public void getFieldMappingAsync (org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsRequest getFieldMappingsRequest ,
270
+ RequestOptions options ,
271
+ ActionListener <org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsResponse > listener ) {
272
+ restHighLevelClient .performRequestAsyncAndParseEntity (getFieldMappingsRequest , IndicesRequestConverters ::getFieldMapping , options ,
273
+ org .elasticsearch .action .admin .indices .mapping .get .GetFieldMappingsResponse ::fromXContent , listener , emptySet ());
274
+ }
275
+
276
+ /**
277
+ * Retrieves the field mappings on an index or indices using the Get Field Mapping API.
278
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html">
279
+ * Get Field Mapping API on elastic.co</a>
280
+ * @param getFieldMappingsRequest the request
281
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
282
+ * @return the response
283
+ * @throws IOException in case there is a problem sending the request or parsing back the response
284
+ */
285
+ public GetFieldMappingsResponse getFieldMapping (GetFieldMappingsRequest getFieldMappingsRequest ,
286
+ RequestOptions options ) throws IOException {
287
+ return restHighLevelClient .performRequestAndParseEntity (getFieldMappingsRequest , IndicesRequestConverters ::getFieldMapping ,
288
+ options , GetFieldMappingsResponse ::fromXContent , emptySet ()
289
+ );
290
+ }
291
+
292
+ /**
293
+ * Asynchronously retrieves the field mappings on an index or indices using the Get Field Mapping API.
294
+ * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html">
295
+ * Get Field Mapping API on elastic.co</a>
296
+ * @param getFieldMappingsRequest the request
297
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
298
+ * @param listener the listener to be notified upon request completion
258
299
*/
259
- public void getFieldMappingAsync (GetFieldMappingsRequest getFieldMappingsRequest , RequestOptions options ,
260
- ActionListener <GetFieldMappingsResponse > listener ) {
300
+ public void getFieldMappingAsync (GetFieldMappingsRequest getFieldMappingsRequest ,
301
+ RequestOptions options , ActionListener <GetFieldMappingsResponse > listener ) {
261
302
restHighLevelClient .performRequestAsyncAndParseEntity (getFieldMappingsRequest , IndicesRequestConverters ::getFieldMapping , options ,
262
303
GetFieldMappingsResponse ::fromXContent , listener , emptySet ());
263
304
}
0 commit comments