Skip to content

Commit 9dcc3ef

Browse files
authored
Always use one shard in vector REST tests. (#51643)
This PR tries to address the intermittent vector test failures on 7.x by making sure we create indices with one shard. The fix is based on this theory as to what's happening: * On 7.x, the default number of shards is 1, but in REST tests we randomly use 2 in order to cover the multiple shards case. In the failing test run, we use 2 shards and all documents end up on only one shard. * During a search, the response from the empty shard doesn't produce deprecation warnings because we never try to execute the script. If not all shard responses contain the warning headers, then certain deprecation warnings can be lost (due to the bug described in #33936). Addresses #50716. Relates to #50061.
1 parent fdf74f6 commit 9dcc3ef

7 files changed

+9
-4
lines changed

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/10_dense_vector_basic.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ setup:
1010
index: test-index
1111
body:
1212
settings:
13+
number_of_shards: 1
1314
number_of_replicas: 0
1415
mappings:
1516
properties:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/15_dense_vector_l1l2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ setup:
1010
index: test-index
1111
body:
1212
settings:
13+
number_of_shards: 1
1314
number_of_replicas: 0
1415
mappings:
1516
properties:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/20_dense_vector_special_cases.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ setup:
1010
index: test-index
1111
body:
1212
settings:
13-
number_of_replicas: 0
14-
# we need to have 1 shard to get request failure in test "Dense vectors should error with sparse vector functions"
1513
number_of_shards: 1
14+
number_of_replicas: 0
1615
mappings:
1716
properties:
1817
my_dense_vector:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/30_sparse_vector_basic.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ setup:
1212
index: test-index
1313
body:
1414
settings:
15+
number_of_shards: 1
1516
number_of_replicas: 0
1617
mappings:
1718
properties:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/35_sparse_vector_l1l2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ setup:
1212
index: test-index
1313
body:
1414
settings:
15+
number_of_shards: 1
1516
number_of_replicas: 0
1617
mappings:
1718
properties:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/40_sparse_vector_special_cases.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ setup:
1212
index: test-index
1313
body:
1414
settings:
15-
number_of_replicas: 0
16-
# we need to have 1 shard to get request failure in test "Sparse vectors should error with dense vector functions"
1715
number_of_shards: 1
16+
number_of_replicas: 0
1817
mappings:
1918
properties:
2019
my_sparse_vector:

x-pack/plugin/src/test/resources/rest-api-spec/test/vectors/50_vector_stats.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ setup:
1717
indices.create:
1818
index: test-index1
1919
body:
20+
settings:
21+
number_of_shards: 1
22+
number_of_replicas: 0
2023
mappings:
2124
properties:
2225
my_dense_vector1:

0 commit comments

Comments
 (0)