-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move required routing validation to IndexRouting (#79472)
Now that we have a place responsible for picking shards we can move the "routing is required" validation there, right next to the validation for the `routing_path` stuff. This feels like a more convenient place to have it. Certainly a nice place to unit test it.
- Loading branch information
Showing
20 changed files
with
258 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/mtermvectors/30_routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
routing: | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 5 | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
- do: | ||
index: | ||
index: test_1 | ||
id: 1 | ||
routing: "5" | ||
body: { foo: bar baz } | ||
|
||
- do: | ||
mtermvectors: | ||
index: test_1 | ||
fields: foo | ||
body: | ||
docs: | ||
- { _id: 1 } | ||
- { _id: 1, routing: "4" } | ||
- { _id: 1, routing: "5" } | ||
|
||
- is_false: docs.0.found | ||
- is_false: docs.1.found | ||
- is_true: docs.2.found | ||
- match: { docs.2._index: test_1 } | ||
- match: { docs.2._id: "1" } | ||
- match: { docs.2.term_vectors.foo.terms.bar.term_freq: 1 } | ||
- match: { docs.2.term_vectors.foo.terms.baz.term_freq: 1 } | ||
|
||
|
||
--- | ||
requires routing: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "fails with an unexpected message in 7.x" | ||
|
||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 5 | ||
number_of_replicas: 0 | ||
mappings: | ||
_routing: | ||
required: true | ||
|
||
- do: | ||
index: | ||
index: test_1 | ||
id: 1 | ||
routing: "5" | ||
body: { foo: bar baz } | ||
|
||
- do: | ||
indices.put_alias: | ||
index: test_1 | ||
name: alias | ||
|
||
- do: | ||
mtermvectors: | ||
fields: foo | ||
body: | ||
docs: | ||
- { _id: 1, _index: test_1 } | ||
- { _id: 1, _index: alias } | ||
- { _id: 1, _index: test_1, routing: "5" } | ||
|
||
- is_false: docs.0.found | ||
- match: { docs.0.error.reason: "routing is required for [test_1]/[1]" } | ||
- match: { docs.0._index: test_1 } | ||
- is_false: docs.1.found | ||
- match: { docs.1.error.reason: "routing is required for [test_1]/[1]" } | ||
- match: { docs.1._index: test_1 } | ||
- is_true: docs.2.found | ||
- match: { docs.2._index: test_1 } | ||
- match: { docs.2._id: "1" } | ||
- match: { docs.2.term_vectors.foo.terms.bar.term_freq: 1 } | ||
- match: { docs.2.term_vectors.foo.terms.baz.term_freq: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.