Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose master_timeout flag on GET _template & HEAD _template #9688

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions rest-api-spec/api/indices.exists_template.json
Expand Up @@ -7,12 +7,16 @@
"paths": ["/_template/{name}"],
"parts": {
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the template"
"type": "string",
"required": true,
"description": "The name of the template"
}
},
"params": {
"master_timeout": {
"type": "time",
"description": "Explicit operation timeout for connection to master node"
},
"local": {
"type": "boolean",
"description": "Return local information, do not retrieve the state from master node (default: false)"
Expand Down
31 changes: 19 additions & 12 deletions rest-api-spec/api/indices.get_template.json
Expand Up @@ -4,23 +4,30 @@
"methods": ["GET"],
"url": {
"path": "/_template/{name}",
"paths": ["/_template", "/_template/{name}"],
"paths": [
"/_template",
"/_template/{name}"
],
"parts": {
"name": {
"type" : "string",
"required" : false,
"description" : "The name of the template"
"type": "string",
"required": false,
"description": "The name of the template"
}
},
"params": {
"flat_settings": {
"type": "boolean",
"description": "Return settings in flat format (default: false)"
},
"local": {
"type": "boolean",
"description": "Return local information, do not retrieve the state from master node (default: false)"
}
"flat_settings": {
"type": "boolean",
"description": "Return settings in flat format (default: false)"
},
"master_timeout": {
"type": "time",
"description": "Explicit operation timeout for connection to master node"
},
"local": {
"type": "boolean",
"description": "Return local information, do not retrieve the state from master node (default: false)"
}
}
},
"body": null
Expand Down
1 change: 1 addition & 0 deletions rest-api-spec/test/indices.exists_template/10_basic.yaml
Expand Up @@ -24,6 +24,7 @@ setup:
- do:
indices.exists_template:
name: test
master_timeout: 1m

- is_true: ''

Expand Down
3 changes: 2 additions & 1 deletion rest-api-spec/test/indices.get_template/10_basic.yaml
Expand Up @@ -46,11 +46,12 @@ setup:
- is_true: test

---
"Get template with non flat settings":
"Get template with non flat settings and master timeout":

- do:
indices.get_template:
name: test
flat_settings: false
master_timeout: 1m

- match: {test.settings: {index: {number_of_shards: '1', number_of_replicas: '0'}}}
Expand Up @@ -56,6 +56,8 @@ public void handleRequest(final RestRequest request, final RestChannel channel,

GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));

getIndexTemplatesRequest.listenerThreaded(false);

final boolean implicitAll = getIndexTemplatesRequest.names().length == 0;
Expand Down
Expand Up @@ -46,6 +46,7 @@ public RestHeadIndexTemplateAction(Settings settings, RestController controller,
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(request.param("name"));
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));
client.admin().indices().getTemplates(getIndexTemplatesRequest, new RestResponseListener<GetIndexTemplatesResponse>(channel) {
@Override
public RestResponse buildResponse(GetIndexTemplatesResponse getIndexTemplatesResponse) {
Expand Down