|
13 | 13 | import org.elasticsearch.client.ResponseException; |
14 | 14 | import org.elasticsearch.client.RestClient; |
15 | 15 | import org.elasticsearch.test.rest.ESRestTestCase; |
| 16 | +import org.elasticsearch.transport.RemoteClusterAware; |
16 | 17 | import org.elasticsearch.xcontent.XContentType; |
17 | 18 | import org.elasticsearch.xpack.esql.AssertWarnings; |
18 | 19 | import org.elasticsearch.xpack.esql.action.EsqlCapabilities; |
@@ -212,13 +213,20 @@ public void testIndicesDontExist() throws IOException { |
212 | 213 | assertThat(e.getMessage(), anyOf(containsString("no such index [foo]"), containsString("no such index [remote_cluster:foo]"))); |
213 | 214 |
|
214 | 215 | if (EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled()) { |
| 216 | + var pattern = from("test1"); |
215 | 217 | e = expectThrows( |
216 | 218 | ResponseException.class, |
217 | | - () -> runEsql(timestampFilter("gte", "2020-01-01").query(from("test1") + " | LOOKUP JOIN foo ON id1")) |
| 219 | + () -> runEsql(timestampFilter("gte", "2020-01-01").query(pattern + " | LOOKUP JOIN foo ON id1")) |
218 | 220 | ); |
219 | 221 | assertEquals(400, e.getResponse().getStatusLine().getStatusCode()); |
220 | | - assertThat(e.getMessage(), containsString("verification_exception")); |
221 | | - assertThat(e.getMessage(), containsString("Unknown index [foo]")); |
| 222 | + assertThat( |
| 223 | + e.getMessage(), |
| 224 | + // currently we don't support remote clusters in LOOKUP JOIN |
| 225 | + // this check happens before resolving actual indices and results in a different error message |
| 226 | + RemoteClusterAware.isRemoteIndexName(pattern) |
| 227 | + ? allOf(containsString("parsing_exception"), containsString("remote clusters are not supported in LOOKUP JOIN")) |
| 228 | + : allOf(containsString("verification_exception"), containsString("Unknown index [foo]")) |
| 229 | + ); |
222 | 230 | } |
223 | 231 | } |
224 | 232 |
|
|
0 commit comments