-
Notifications
You must be signed in to change notification settings - Fork 24.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Returns information about settings, aliases, warmers, and mappings. Basically returns the IndexMetadata. This new endpoint replaces the /{index}/_alias|_aliases|_mapping|_mappings|_settings|_warmer|_warmers and /_alias|_aliases|_mapping|_mappings|_settings|_warmer|_warmers endpoints whilst maintaining the same response formats. The only exception to this is on the /_alias|_aliases|_warmer|_warmers endpoint which will now return a section for 'aliases' or 'warmers' even if no aliases or warmers exist. This backwards compatibility change is documented in the reference docs. Closes #4069
- Loading branch information
Showing
28 changed files
with
1,329 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[[indices-get-index]] | ||
== Get Index | ||
|
||
The get index API allows to retrieve information about one or more indexes. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
$ curl -XGET 'http://localhost:9200/twitter/' | ||
-------------------------------------------------- | ||
|
||
The above example gets the information for an index called `twitter`. Specifying an index, | ||
alias or wildcard expression is required. | ||
|
||
The get index API can also be applied to more than one index, or on | ||
all indices by using `_all` or `*` as index. | ||
|
||
[float] | ||
=== Filtering index information | ||
|
||
The information returned by the get API can be filtered to include only specific features | ||
by specifying a comma delimited list of features in the URL: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
$ curl -XGET 'http://localhost:9200/twitter/_settings,_mappings' | ||
-------------------------------------------------- | ||
|
||
The above command will only return the settings and mappings for the index called `twitter`. | ||
|
||
The available features are `_settings`, `_mappings`, `_warmers` and `_aliases`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"indices.get":{ | ||
"documentation":"http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/indices-get.html", | ||
"methods":[ "GET" ], | ||
"url":{ | ||
"path":"/{index}", | ||
"paths":[ "/{index}", "/{index}/{feature}" ], | ||
"parts":{ | ||
"index":{ | ||
"type":"list", | ||
"description":"A comma-separated list of index names" | ||
}, | ||
"feature":{ | ||
"type":"list", | ||
"description":"A comma-separated list of features" | ||
} | ||
}, | ||
"params":{ | ||
"local":{ | ||
"type":"boolean", | ||
"description":"Return local information, do not retrieve the state from master node (default: false)" | ||
}, | ||
"ignore_unavailable":{ | ||
"type":"boolean", | ||
"description":"Ignore unavailable indexes (default: false)" | ||
}, | ||
"allow_no_indices":{ | ||
"type":"boolean", | ||
"description":"Ignore if a wildcard expression resolves to no concrete indices (default: false)" | ||
}, | ||
"expand_wildcards":{ | ||
"type":"list", | ||
"description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
--- | ||
setup: | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
aliases: | ||
test_alias: {} | ||
test_blias: {} | ||
mappings: | ||
type_1: {} | ||
warmers: | ||
test_warmer: | ||
source: | ||
query: | ||
match_all: {} | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 1 | ||
|
||
- do: | ||
indices.create: | ||
index: test_index_2 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 2 | ||
aliases: | ||
test_alias: {} | ||
test_blias: {} | ||
|
||
- do: | ||
indices.create: | ||
index: test_index_3 | ||
body: | ||
aliases: | ||
test_alias: {} | ||
test_blias: {} | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
|
||
- do: | ||
indices.close: | ||
index: test_index_3 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
|
||
--- | ||
"Get index infos": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index | ||
|
||
- is_true: test_index.aliases | ||
- is_true: test_index.settings | ||
- is_true: test_index.warmers | ||
- is_true: test_index.mappings | ||
|
||
--- | ||
"Get index infos for mappings only": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index | ||
feature: _mapping | ||
|
||
- is_true: test_index.mappings | ||
- is_false: test_index.aliases | ||
- is_false: test_index.settings | ||
- is_false: test_index.warmers | ||
|
||
--- | ||
"Get index infos for mappings and warmers only": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index | ||
feature: _mapping,_warmer | ||
|
||
- is_true: test_index.mappings | ||
- is_true: test_index.warmers | ||
- is_false: test_index.aliases | ||
- is_false: test_index.settings | ||
|
||
--- | ||
"Get index infos should work on aliases": | ||
|
||
- do: | ||
indices.get: | ||
index: test_blias | ||
feature: _mapping,_warmer | ||
|
||
- is_true: test_index.mappings | ||
- is_true: test_index.warmers | ||
- is_false: test_index.aliases | ||
- is_false: test_index.settings | ||
|
||
--- | ||
"Get index infos should work for wildcards": | ||
|
||
- do: | ||
indices.get: | ||
index: test_* | ||
feature: _mapping,_settings | ||
|
||
- is_true: test_index.mappings | ||
- is_true: test_index.settings | ||
- is_true: test_index_2.settings | ||
- is_false: test_index.aliases | ||
- is_false: test_index.warmers | ||
|
||
--- | ||
"Missing index should throw an Error": | ||
|
||
- do: | ||
catch: missing | ||
indices.get: | ||
index: test_not_found | ||
|
||
--- | ||
"Missing index should return empty object if ignore_unavailable": | ||
|
||
- do: | ||
indices.get: | ||
index: test_not_found | ||
ignore_unavailable: true | ||
|
||
- match: { $body: "{}" } | ||
|
||
--- | ||
"Should return empty object if allow_no_indices": | ||
|
||
- do: | ||
indices.get: | ||
index: test_not* | ||
|
||
- match: { $body: "{}" } | ||
|
||
--- | ||
"Should throw error if allow_no_indices=false": | ||
|
||
- do: | ||
catch: missing | ||
indices.get: | ||
index: test_not* | ||
allow_no_indices: false | ||
|
||
--- | ||
"Should return test_index_2 if expand_wildcards=open": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index_* | ||
expand_wildcards: open | ||
|
||
- is_true: test_index_2.settings | ||
- is_false: test_index_3.settings | ||
|
||
--- | ||
"Should return test_index_3 if expand_wildcards=closed": | ||
|
||
- skip: | ||
version: "0 - 2.0.0" | ||
reason: Requires fix for issue 7258 | ||
|
||
- do: | ||
indices.get: | ||
index: test_index_* | ||
feature: _settings | ||
expand_wildcards: closed | ||
|
||
- is_false: test_index_2.settings | ||
- is_true: test_index_3.settings | ||
|
||
--- | ||
"Should return test_index_2 and test_index_3 if expand_wildcards=open,closed": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index_* | ||
feature: _settings | ||
expand_wildcards: open,closed | ||
|
||
- is_true: test_index_2.settings | ||
- is_true: test_index_3.settings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.