Britta Weber 411739fe3b Make PUT and DELETE consistent for _mapping, _alias and _warmer
See issue #4071

PUT options for _mapping:

Single type can now be added with

`[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type`

and

`[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]`

PUT options for _warmer:

PUT with a single warmer can now be done with

`[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name`

PUT options for _alias:

Single alias can now be PUT with

`[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias`

DELETE options _mapping:

Several mappings can be deleted at once by defining several indices and types with

`[DELETE] /{index}/{type}`

`[DELETE] /{index}/{type}/_mapping`

`[DELETE] /{index}/_mapping/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_mapings` can be used.

DELETE options for  _warmer:

Several warmers can be deleted at once by defining several indices and names with

`[DELETE] /{index}/_warmer/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_warmers` can be used.

DELETE options for _alias:

Several aliases can be deleted at once by defining several indices and names with

`[DELETE] /{index}/_alias/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_aliases` can be used.
2014-01-14 20:02:43 +01:00

226 lines
4.9 KiB
YAML

---
setup:
- do:
indices.create:
index: test_index1
- do:
indices.create:
index: test_index2
- do:
indices.create:
index: foo
- do:
indices.put_alias:
name: alias1
body:
routing: "routing value"
- do:
indices.put_alias:
name: alias2
body:
routing: "routing value"
---
"check setup":
- do:
indices.get_alias:
name: alias1
- match: {test_index1.aliases.alias1.search_routing: "routing value"}
- match: {test_index2.aliases.alias1.search_routing: "routing value"}
- match: {foo.aliases.alias1.search_routing: "routing value"}
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check delete with _all index":
- do:
indices.delete_alias:
index: _all
name: alias1
- do:
catch: missing
indices.get_alias:
name: alias1
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check delete with * index":
- do:
indices.delete_alias:
index: "*"
name: alias1
- do:
catch: missing
indices.get_alias:
name: alias1
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check delete with index list":
- do:
indices.delete_alias:
index: "test_index1,test_index2"
name: alias1
- do:
indices.get_alias:
name: alias1
- match: {foo.aliases.alias1.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check delete with prefix* index":
- do:
indices.delete_alias:
index: "test_*"
name: alias1
- do:
indices.get_alias:
name: alias1
- match: {foo.aliases.alias1.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check delete with index list and * aliases":
- do:
indices.delete_alias:
index: "test_index1,test_index2"
name: "*"
- do:
indices.get_alias:
name: alias1
- match: {foo.aliases.alias1.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
- do:
indices.get_alias:
name: alias2
- match: {foo.aliases.alias2.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
---
"check delete with index list and _all aliases":
- do:
indices.delete_alias:
index: "test_index1,test_index2"
name: _all
- do:
indices.get_alias:
name: alias1
- match: {foo.aliases.alias1.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
- do:
indices.get_alias:
name: alias2
- match: {foo.aliases.alias2.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
---
"check delete with index list and wildcard aliases":
- do:
indices.delete_alias:
index: "test_index1,test_index2"
name: "*1"
- do:
indices.get_alias:
name: alias1
- match: {foo.aliases.alias1.search_routing: "routing value"}
- is_false: test_index1
- is_false: test_index2
- do:
indices.get_alias:
name: alias2
- match: {test_index1.aliases.alias2.search_routing: "routing value"}
- match: {test_index2.aliases.alias2.search_routing: "routing value"}
- match: {foo.aliases.alias2.search_routing: "routing value"}
---
"check 404 on no matching alias":
- do:
catch: missing
indices.delete_alias:
index: "*"
name: "non_existent"
- do:
catch: missing
indices.delete_alias:
index: "non_existent"
name: "alias1"
---
"check delete with blank index and blank alias":
- do:
catch: param
indices.delete_alias:
name: "alias1"
- do:
catch: param
indices.delete_alias:
index: "test_index1"