Skip to content

Commit

Permalink
Added extra rest endpoint for get settings api.
Browse files Browse the repository at this point in the history
Added rest test to also test the get settings' prefix option.
  • Loading branch information
martijnvg committed Jan 9, 2014
1 parent 36e58c0 commit 0973b28
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/reference/indices/get-settings.asciidoc
Expand Up @@ -40,6 +40,8 @@ curl -XGET 'http://localhost:9200/my-index/_settings?prefix=index.'
curl -XGET 'http://localhost:9200/_all/_settings?prefix=index.routing.allocation.'
curl -XGET 'http://localhost:9200/2013-*/_settings?prefix=index.merge.'
curl -XGET 'http://localhost:9200/2013-*/index.merge./_settings'
--------------------------------------------------

The first example returns all index settings the start with `index.` in the index `my-index`,
Expand Down
6 changes: 5 additions & 1 deletion rest-api-spec/api/indices.get_settings.json
Expand Up @@ -4,11 +4,15 @@
"methods": ["GET"],
"url": {
"path": "/_settings",
"paths": ["/_settings", "/{index}/_settings"],
"paths": ["/_settings", "/{index}/_settings", "/{index}/{prefix}/_settings"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
},
"prefix": {
"type" : "string",
"description" : "The prefix all settings must have in order to be included"
}
},
"params": {
Expand Down
32 changes: 32 additions & 0 deletions rest-api-spec/test/indices.get_settings/10_basic.yaml
@@ -0,0 +1,32 @@
---
"Test get indices settings":
- do:
indices.create:
index: test-index
body:
settings:
index:
refresh_interval: -1
number_of_shards: 2
number_of_replicas: 3

- do:
indices.get_settings:
index: test-index

- match:
test-index.settings.index.number_of_replicas: "3"
- match:
test-index.settings.index.number_of_shards: "2"
- match:
test-index.settings.index.refresh_interval: "-1"

- do:
indices.get_settings:
index: _all
prefix: index.number

- match:
test-index.settings.index.number_of_replicas: "3"
- match:
test-index.settings.index.number_of_shards: "2"
Expand Up @@ -46,6 +46,7 @@ public RestGetSettingsAction(Settings settings, Client client, RestController co
super(settings, client);
controller.registerHandler(GET, "/_settings", this);
controller.registerHandler(GET, "/{index}/_settings", this);
controller.registerHandler(GET, "/{index}/{prefix}/_settings", this);
}

@Override
Expand Down

0 comments on commit 0973b28

Please sign in to comment.