Luca Cavanna 3afdf4a872 Added support for aliases to create index api
It is now possible to specify aliases during index creation:

curl -XPUT 'http://localhost:9200/test' -d '
{
    "aliases" : {
        "alias1" : {},
        "alias2" : {
            "filter" : { "term" : {"field":"value"}}
        }
    }
}'

Closes #4920
2014-02-17 14:54:21 +01:00

125 lines
2.7 KiB
YAML

---
"Create index with mappings":
- do:
indices.create:
index: test_index
body:
mappings:
type_1: {}
- do:
indices.get_mapping:
index: test_index
- match: { test_index.mappings.type_1.properties: {}}
---
"Create index with settings":
- do:
indices.create:
index: test_index
body:
settings:
number_of_replicas: "0"
- do:
indices.get_settings:
index: test_index
- match: { test_index.settings.index.number_of_replicas: "0"}
---
"Create index with warmers":
- do:
indices.create:
index: test_index
body:
warmers:
test_warmer:
source:
query:
match_all: {}
- do:
indices.get_warmer:
index: test_index
- match: {test_index.warmers.test_warmer.source.query.match_all: {}}
---
"Create index with aliases":
- do:
indices.create:
index: test_index
body:
aliases:
test_alias: {}
test_blias:
routing: b
test_clias:
filter:
term:
field : value
- do:
indices.get_alias:
index: test_index
- match: {test_index.aliases.test_alias: {}}
- match: {test_index.aliases.test_blias.search_routing: b}
- match: {test_index.aliases.test_blias.index_routing: b}
- is_false: test_index.aliases.test_blias.filter
- match: {test_index.aliases.test_clias.filter.term.field: value}
- is_false: test_index.aliases.test_clias.index_routing
- is_false: test_index.aliases.test_clias.search_routing
---
"Create index with mappings, settings, warmers and aliases":
- do:
indices.create:
index: test_index
body:
mappings:
type_1: {}
settings:
number_of_replicas: "0"
warmers:
test_warmer:
source:
query:
match_all: {}
aliases:
test_alias: {}
test_blias: {routing: b}
- do:
indices.get_mapping:
index: test_index
- match: { test_index.mappings.type_1.properties: {}}
- do:
indices.get_settings:
index: test_index
- match: { test_index.settings.index.number_of_replicas: "0"}
- do:
indices.get_warmer:
index: test_index
- match: { test_index.warmers.test_warmer.source.query.match_all: {}}
- do:
indices.get_alias:
index: test_index
- match: { test_index.aliases.test_alias: {}}
- match: { test_index.aliases.test_blias.search_routing: b}
- match: { test_index.aliases.test_blias.index_routing: b}