javanna 11f7c31852 Put index template api: unified PUT/POST behaviour in relation to create parameter
The put index template api supports the create parameter (defaults to false), which tells whether the template can replace an existing one with same name or not. Unified its behaviour between PUT and POST method, whereas the POST would previously force create to true.

Added create parameter to the rest spec (was missing before) and a REST test for create true scenario.
2014-06-06 15:45:05 +02:00

72 lines
1.6 KiB
YAML

---
"Put template":
- do:
indices.put_template:
name: test
body:
template: test-*
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.get_template:
name: test
- match: {test.template: "test-*"}
- match: {test.settings: {index.number_of_shards: '1', index.number_of_replicas: '0'}}
---
"Put template with aliases":
- do:
indices.put_template:
name: test
body:
template: test-*
aliases:
test_alias: {}
test_blias: { routing: b }
test_clias: { filter: { term: { user: kimchy }}}
- do:
indices.get_template:
name: test
- match: { test.template: "test-*" }
- length: { test.aliases: 3 }
- is_true: test.aliases.test_alias
- match: { test.aliases.test_blias.index_routing: "b" }
- match: { test.aliases.test_blias.search_routing: "b" }
- match: { test.aliases.test_clias.filter.term.user: "kimchy" }
---
"Put template create":
- do:
indices.put_template:
name: test
create: true
body:
template: test-*
settings:
number_of_shards: 1
number_of_replicas: 0
- do:
indices.get_template:
name: test
- match: {test.template: "test-*"}
- match: {test.settings: {index.number_of_shards: '1', index.number_of_replicas: '0'}}
- do:
catch: request
indices.put_template:
name: test
create: true
body:
template: test-*
settings:
number_of_shards: 1
number_of_replicas: 0