Skip to content

Commit e56d338

Browse files
committed
Simplify logic around missing shards check in search phases
This removes a couple of indirections: the error message for missing shards is always the same no matter the search phase. This was required to provide a slightly different error message for open PIT. The previous error was misleading when open PIT did not support setting allow_partial_search_results, but now that it does, it looks like we can unify the error message and simplify the code around it.
1 parent 02623e0 commit e56d338

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

server/src/internalClusterTest/java/org/elasticsearch/search/retriever/RetrieverRewriteIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ public void testRewriteCompoundRetrieverShouldThrowForPartialResults() throws Ex
127127
SearchPhaseExecutionException.class,
128128
client().prepareSearch(testIndex).setSource(source)::get
129129
);
130-
assertThat(ex.getDetailedMessage(), containsString("Search rejected due to missing shards"));
130+
assertThat(
131+
ex.getDetailedMessage(),
132+
containsString("Search rejected due to missing shards")
133+
);
131134
} finally {
132135
internalCluster().restartNode(randomDataNode);
133136
}

x-pack/plugin/sql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/sql/qa/single_node/JdbcShardFailureIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void testPartialResponseHandling() throws Exception {
8989
createTestIndex();
9090
try (Connection c = esJdbc(); Statement s = c.createStatement()) {
9191
SQLException exception = expectThrows(SQLException.class, () -> s.executeQuery("SELECT * FROM test ORDER BY test_field ASC"));
92-
assertThat(exception.getMessage(), containsString("[open_point_in_time] action requires all shards to be available"));
92+
assertThat(exception.getMessage(), containsString("Search rejected due to missing shards"));
9393
}
9494
}
9595

0 commit comments

Comments
 (0)