|
37 | 37 | import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
|
38 | 38 | import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
39 | 39 | import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
|
| 40 | +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; |
| 41 | +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; |
40 | 42 | import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
41 | 43 | import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
42 | 44 | import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
|
57 | 59 | import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
58 | 60 | import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
59 | 61 | import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
| 62 | +import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; |
| 63 | +import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; |
60 | 64 | import org.elasticsearch.rest.RestStatus;
|
61 | 65 |
|
62 | 66 | import java.io.IOException;
|
@@ -186,6 +190,35 @@ public void getMappingsAsync(GetMappingsRequest getMappingsRequest, RequestOptio
|
186 | 190 | GetMappingsResponse::fromXContent, listener, emptySet());
|
187 | 191 | }
|
188 | 192 |
|
| 193 | + /** |
| 194 | + * Retrieves the field mappings on an index or indices using the Get Field Mapping API. |
| 195 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html"> |
| 196 | + * Get Field Mapping API on elastic.co</a> |
| 197 | + * @param getFieldMappingsRequest the request |
| 198 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 199 | + * @return the response |
| 200 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 201 | + */ |
| 202 | + public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest, |
| 203 | + RequestOptions options) throws IOException { |
| 204 | + return restHighLevelClient.performRequestAndParseEntity(getFieldMappingsRequest, RequestConverters::getFieldMapping, options, |
| 205 | + GetFieldMappingsResponse::fromXContent, emptySet()); |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * Asynchronously retrieves the field mappings on an index on indices using the Get Field Mapping API. |
| 210 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html"> |
| 211 | + * Get Field Mapping API on elastic.co</a> |
| 212 | + * @param getFieldMappingsRequest the request |
| 213 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 214 | + * @param listener the listener to be notified upon request completion |
| 215 | + */ |
| 216 | + public void getFieldMappingAsync(GetFieldMappingsRequest getFieldMappingsRequest, RequestOptions options, |
| 217 | + ActionListener<GetFieldMappingsResponse> listener) { |
| 218 | + restHighLevelClient.performRequestAsyncAndParseEntity(getFieldMappingsRequest, RequestConverters::getFieldMapping, options, |
| 219 | + GetFieldMappingsResponse::fromXContent, listener, emptySet()); |
| 220 | + } |
| 221 | + |
189 | 222 | /**
|
190 | 223 | * Updates aliases using the Index Aliases API.
|
191 | 224 | * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
|
@@ -661,6 +694,36 @@ public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest, Re
|
661 | 694 | PutIndexTemplateResponse::fromXContent, listener, emptySet());
|
662 | 695 | }
|
663 | 696 |
|
| 697 | + /** |
| 698 | + * Validate a potentially expensive query without executing it. |
| 699 | + * <p> |
| 700 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html"> Validate Query API |
| 701 | + * on elastic.co</a> |
| 702 | + * @param validateQueryRequest the request |
| 703 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 704 | + * @return the response |
| 705 | + * @throws IOException in case there is a problem sending the request or parsing back the response |
| 706 | + */ |
| 707 | + public ValidateQueryResponse validateQuery(ValidateQueryRequest validateQueryRequest, RequestOptions options) throws IOException { |
| 708 | + return restHighLevelClient.performRequestAndParseEntity(validateQueryRequest, RequestConverters::validateQuery, options, |
| 709 | + ValidateQueryResponse::fromXContent, emptySet()); |
| 710 | + } |
| 711 | + |
| 712 | + /** |
| 713 | + * Asynchronously validate a potentially expensive query without executing it. |
| 714 | + * <p> |
| 715 | + * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-validate.html"> Validate Query API |
| 716 | + * on elastic.co</a> |
| 717 | + * @param validateQueryRequest the request |
| 718 | + * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized |
| 719 | + * @param listener the listener to be notified upon request completion |
| 720 | + */ |
| 721 | + public void validateQueryAsync(ValidateQueryRequest validateQueryRequest, RequestOptions options, |
| 722 | + ActionListener<ValidateQueryResponse> listener) { |
| 723 | + restHighLevelClient.performRequestAsyncAndParseEntity(validateQueryRequest, RequestConverters::validateQuery, options, |
| 724 | + ValidateQueryResponse::fromXContent, listener, emptySet()); |
| 725 | + } |
| 726 | + |
664 | 727 | /**
|
665 | 728 | * Gets index templates using the Index Templates API
|
666 | 729 | * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html"> Index Templates API
|
|
0 commit comments