Browse Source

Added extra rest endpoint for get settings api.
Added rest test to also test the get settings' prefix option.

Martijn van Groningen 11 years ago
parent
commit
0973b2863c

+ 2 - 0
docs/reference/indices/get-settings.asciidoc

@@ -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`,

+ 5 - 1
rest-api-spec/api/indices.get_settings.json

@@ -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": {

+ 32 - 0
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"

+ 1 - 0
src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java

@@ -46,6 +46,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
         super(settings, client);
         controller.registerHandler(GET, "/_settings", this);
         controller.registerHandler(GET, "/{index}/_settings", this);
+        controller.registerHandler(GET, "/{index}/{prefix}/_settings", this);
     }
 
     @Override