|
@@ -0,0 +1,304 @@
|
|
|
+more than 1:
|
|
|
+ - do:
|
|
|
+ indices.create:
|
|
|
+ index: source
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_shards: 2
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_routing_shards: 4
|
|
|
+ index.routing_partition_size: 2
|
|
|
+ mappings:
|
|
|
+ _routing:
|
|
|
+ required: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 1
|
|
|
+ routing: 1
|
|
|
+ body: { "foo": "hello world" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 2
|
|
|
+ routing: 2
|
|
|
+ body: { "foo": "hello world 2" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 3
|
|
|
+ routing: 3
|
|
|
+ body: { "foo": "hello world 3" }
|
|
|
+
|
|
|
+ # make it read-only
|
|
|
+ - do:
|
|
|
+ indices.put_settings:
|
|
|
+ index: source
|
|
|
+ body:
|
|
|
+ index.blocks.write: true
|
|
|
+ index.number_of_replicas: 0
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+ index: source
|
|
|
+
|
|
|
+ # now we do the actual split
|
|
|
+ - do:
|
|
|
+ indices.split:
|
|
|
+ index: "source"
|
|
|
+ target: "target"
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ master_timeout: 10s
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_shards: 4
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 1
|
|
|
+ id: 1
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "1" }
|
|
|
+ - match: { _source: { foo: "hello world" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 2
|
|
|
+ id: 2
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "2" }
|
|
|
+ - match: { _source: { foo: "hello world 2" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 3
|
|
|
+ id: 3
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "3" }
|
|
|
+ - match: { _source: { foo: "hello world 3" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: target
|
|
|
+ - match: { hits.total.value: 3 }
|
|
|
+
|
|
|
+---
|
|
|
+exactly 1:
|
|
|
+ - do:
|
|
|
+ indices.create:
|
|
|
+ index: source
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_shards: 2
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_routing_shards: 4
|
|
|
+ index.routing_partition_size: 1
|
|
|
+ mappings:
|
|
|
+ _routing:
|
|
|
+ required: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 1
|
|
|
+ routing: 1
|
|
|
+ body: { "foo": "hello world" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 2
|
|
|
+ routing: 2
|
|
|
+ body: { "foo": "hello world 2" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 3
|
|
|
+ routing: 3
|
|
|
+ body: { "foo": "hello world 3" }
|
|
|
+
|
|
|
+ # make it read-only
|
|
|
+ - do:
|
|
|
+ indices.put_settings:
|
|
|
+ index: source
|
|
|
+ body:
|
|
|
+ index.blocks.write: true
|
|
|
+ index.number_of_replicas: 0
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+ index: source
|
|
|
+
|
|
|
+ # now we do the actual split
|
|
|
+ - do:
|
|
|
+ indices.split:
|
|
|
+ index: "source"
|
|
|
+ target: "target"
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ master_timeout: 10s
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_shards: 4
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 1
|
|
|
+ id: 1
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "1" }
|
|
|
+ - match: { _source: { foo: "hello world" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 2
|
|
|
+ id: 2
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "2" }
|
|
|
+ - match: { _source: { foo: "hello world 2" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 3
|
|
|
+ id: 3
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "3" }
|
|
|
+ - match: { _source: { foo: "hello world 3" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: target
|
|
|
+ - match: { hits.total.value: 3 }
|
|
|
+
|
|
|
+---
|
|
|
+nested:
|
|
|
+ - do:
|
|
|
+ indices.create:
|
|
|
+ index: source
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_shards: 2
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_routing_shards: 4
|
|
|
+ index.routing_partition_size: 2
|
|
|
+ mappings:
|
|
|
+ _routing:
|
|
|
+ required: true
|
|
|
+ properties:
|
|
|
+ n:
|
|
|
+ type: nested
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 1
|
|
|
+ routing: 1
|
|
|
+ body: { "foo": "hello world", "n": [{"foo": "goodbye world"}, {"foo": "more words"}] }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 2
|
|
|
+ routing: 2
|
|
|
+ body: { "foo": "hello world 2" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: source
|
|
|
+ id: 3
|
|
|
+ routing: 3
|
|
|
+ body: { "foo": "hello world 3" }
|
|
|
+
|
|
|
+ # make it read-only
|
|
|
+ - do:
|
|
|
+ indices.put_settings:
|
|
|
+ index: source
|
|
|
+ body:
|
|
|
+ index.blocks.write: true
|
|
|
+ index.number_of_replicas: 0
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+ index: source
|
|
|
+
|
|
|
+ # now we do the actual split
|
|
|
+ - do:
|
|
|
+ indices.split:
|
|
|
+ index: "source"
|
|
|
+ target: "target"
|
|
|
+ wait_for_active_shards: 1
|
|
|
+ master_timeout: 10s
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.number_of_replicas: 0
|
|
|
+ index.number_of_shards: 4
|
|
|
+
|
|
|
+ - do:
|
|
|
+ cluster.health:
|
|
|
+ wait_for_status: green
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 1
|
|
|
+ id: 1
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "1" }
|
|
|
+ - match: { _source: { "foo": "hello world", "n": [{"foo": "goodbye world"}, {"foo": "more words"}] } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 2
|
|
|
+ id: 2
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "2" }
|
|
|
+ - match: { _source: { foo: "hello world 2" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ get:
|
|
|
+ index: target
|
|
|
+ routing: 3
|
|
|
+ id: 3
|
|
|
+
|
|
|
+ - match: { _index: target }
|
|
|
+ - match: { _id: "3" }
|
|
|
+ - match: { _source: { foo: "hello world 3" } }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: target
|
|
|
+ - match: { hits.total.value: 3 }
|