|
50 | 50 | import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
|
51 | 51 | import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
|
52 | 52 | import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
|
| 53 | +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; |
53 | 54 | import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
54 | 55 | import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
55 | 56 | import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
|
71 | 72 | import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
72 | 73 | import org.elasticsearch.action.ingest.PutPipelineRequest;
|
73 | 74 | import org.elasticsearch.action.ingest.GetPipelineRequest;
|
| 75 | +import org.elasticsearch.action.ingest.SimulatePipelineRequest; |
74 | 76 | import org.elasticsearch.action.search.ClearScrollRequest;
|
75 | 77 | import org.elasticsearch.action.search.MultiSearchRequest;
|
76 | 78 | import org.elasticsearch.action.search.SearchRequest;
|
@@ -229,6 +231,25 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) throws IOExcep
|
229 | 231 | return request;
|
230 | 232 | }
|
231 | 233 |
|
| 234 | + static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest) throws IOException { |
| 235 | + String[] indices = getFieldMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.indices(); |
| 236 | + String[] types = getFieldMappingsRequest.types() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.types(); |
| 237 | + String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields(); |
| 238 | + |
| 239 | + String endpoint = new EndpointBuilder().addCommaSeparatedPathParts(indices) |
| 240 | + .addPathPartAsIs("_mapping").addCommaSeparatedPathParts(types) |
| 241 | + .addPathPartAsIs("field").addCommaSeparatedPathParts(fields) |
| 242 | + .build(); |
| 243 | + |
| 244 | + Request request = new Request(HttpGet.METHOD_NAME, endpoint); |
| 245 | + |
| 246 | + Params parameters = new Params(request); |
| 247 | + parameters.withIndicesOptions(getFieldMappingsRequest.indicesOptions()); |
| 248 | + parameters.withIncludeDefaults(getFieldMappingsRequest.includeDefaults()); |
| 249 | + parameters.withLocal(getFieldMappingsRequest.local()); |
| 250 | + return request; |
| 251 | + } |
| 252 | + |
232 | 253 | static Request refresh(RefreshRequest refreshRequest) {
|
233 | 254 | String[] indices = refreshRequest.indices() == null ? Strings.EMPTY_ARRAY : refreshRequest.indices();
|
234 | 255 | Request request = new Request(HttpPost.METHOD_NAME, endpoint(indices, "_refresh"));
|
@@ -886,6 +907,20 @@ static Request validateQuery(ValidateQueryRequest validateQueryRequest) throws I
|
886 | 907 | return request;
|
887 | 908 | }
|
888 | 909 |
|
| 910 | + static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException { |
| 911 | + EndpointBuilder builder = new EndpointBuilder().addPathPartAsIs("_ingest/pipeline"); |
| 912 | + if (simulatePipelineRequest.getId() != null && !simulatePipelineRequest.getId().isEmpty()) { |
| 913 | + builder.addPathPart(simulatePipelineRequest.getId()); |
| 914 | + } |
| 915 | + builder.addPathPartAsIs("_simulate"); |
| 916 | + String endpoint = builder.build(); |
| 917 | + Request request = new Request(HttpPost.METHOD_NAME, endpoint); |
| 918 | + Params params = new Params(request); |
| 919 | + params.putParam("verbose", Boolean.toString(simulatePipelineRequest.isVerbose())); |
| 920 | + request.setEntity(createEntity(simulatePipelineRequest, REQUEST_BODY_CONTENT_TYPE)); |
| 921 | + return request; |
| 922 | + } |
| 923 | + |
889 | 924 | static Request getAlias(GetAliasesRequest getAliasesRequest) {
|
890 | 925 | String[] indices = getAliasesRequest.indices() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.indices();
|
891 | 926 | String[] aliases = getAliasesRequest.aliases() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.aliases();
|
|
0 commit comments