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

179 lines
4.4 KiB
YAML

setup:
- do:
indices.create:
index: test_index1
- do:
indices.create:
index: test_index2
- do:
indices.create:
index: foo
---
"put one mapping per index":
- do:
indices.put_mapping:
index: test_index1
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.put_mapping:
index: test_index2
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo: {}}
---
"put mapping in _all index":
- do:
indices.put_mapping:
index: _all
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo.test_type.properties.text.type: string}
- match: {foo.test_type.properties.text.analyzer: whitespace}
---
"put mapping in * index":
- do:
indices.put_mapping:
index: "*"
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo.test_type.properties.text.type: string}
- match: {foo.test_type.properties.text.analyzer: whitespace}
---
"put mapping in prefix* index":
- do:
indices.put_mapping:
index: "test_index*"
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo: {}}
---
"put mapping in list of indices":
- do:
indices.put_mapping:
index: [test_index1, test_index2]
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo: {}}
---
"put mapping with blank index":
- do:
indices.put_mapping:
type: test_type
body:
test_type:
properties:
text:
type: string
analyzer: whitespace
- do:
indices.get_mapping: {}
- match: {test_index1.test_type.properties.text.type: string}
- match: {test_index1.test_type.properties.text.analyzer: whitespace}
- match: {test_index2.test_type.properties.text.type: string}
- match: {test_index2.test_type.properties.text.analyzer: whitespace}
- match: {foo.test_type.properties.text.type: string}
- match: {foo.test_type.properties.text.analyzer: whitespace}
---
"put mapping with mising type":
- do:
catch: param
indices.put_mapping: {}