File tree Expand file tree Collapse file tree 5 files changed +33
-29
lines changed
esql/src/main/java/org/elasticsearch/xpack/esql
src/yamlRestTest/resources/rest-api-spec/test/esql Expand file tree Collapse file tree 5 files changed +33
-29
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
133133 task. replaceValueInMatch(" Size" , 49 , " Test flamegraph from test-events" )
134134 task. skipTest(" esql/90_non_indexed/fetch" , " Temporary until backported" )
135135 task. skipTest(" esql/63_enrich_int_range/Invalid age as double" , " TODO: require disable allow_partial_results" )
136+ task. skipTest(" esql/191_lookup_join_on_datastreams/data streams not supported in LOOKUP JOIN" , " Added support for aliases in JOINs" )
136137})
137138
138139tasks. named(' yamlRestCompatTest' ). configure {
Original file line number Diff line number Diff line change @@ -1128,7 +1128,12 @@ public enum Cap {
11281128 /**
11291129 * Dense vector field type support
11301130 */
1131- DENSE_VECTOR_FIELD_TYPE (EsqlCorePlugin .DENSE_VECTOR_FEATURE_FLAG );
1131+ DENSE_VECTOR_FIELD_TYPE (EsqlCorePlugin .DENSE_VECTOR_FEATURE_FLAG ),
1132+
1133+ /**
1134+ * Enable support for index aliases in lookup joins
1135+ */
1136+ ENABLE_LOOKUP_JOIN_ON_ALIASES (JOIN_LOOKUP_V12 .isEnabled ());
11321137
11331138 private final boolean enabled ;
11341139
Original file line number Diff line number Diff line change @@ -190,12 +190,12 @@ public void writeTo(StreamOutput out) throws IOException {
190190 out .writeString (sessionId );
191191 out .writeWriteable (shardId );
192192
193- if (indexPattern .equals (shardId .getIndexName ()) == false
194- && out .getTransportVersion ().before (TransportVersions .JOIN_ON_ALIASES )) {
193+ if (out .getTransportVersion ().onOrAfter (TransportVersions .JOIN_ON_ALIASES )) {
194+ out .writeString (indexPattern );
195+ } else if (indexPattern .equals (shardId .getIndexName ()) == false ) {
195196 // TODO can we throw exceptions here?
196197 throw new VerificationException ("Aliases and index patterns are not allowed for LOOKUP JOIN []" , indexPattern );
197198 }
198- out .writeString (indexPattern );
199199
200200 out .writeString (inputDataType .typeName ());
201201 out .writeWriteable (inputPage );
Original file line number Diff line number Diff line change 66 - method : POST
77 path : /_query
88 parameters : []
9- capabilities : [join_lookup_v12, join_lookup_skip_mv_warnings ]
9+ capabilities : [join_lookup_v12, enable_lookup_join_on_aliases ]
1010 reason : " uses LOOKUP JOIN"
1111 - do :
1212 indices.create :
@@ -187,8 +187,6 @@ non-lookup index:
187187
188188---
189189alias-repeated-alias :
190- - skip :
191- awaits_fix : " LOOKUP JOIN does not support index aliases for now"
192190 - do :
193191 esql.query :
194192 body :
@@ -203,8 +201,6 @@ alias-repeated-alias:
203201
204202---
205203alias-repeated-index :
206- - skip :
207- awaits_fix : " LOOKUP JOIN does not support index aliases for now"
208204 - do :
209205 esql.query :
210206 body :
@@ -219,21 +215,17 @@ alias-repeated-index:
219215
220216---
221217alias-pattern-multiple :
222- - skip :
223- awaits_fix : " LOOKUP JOIN does not support index aliases for now"
224218 - do :
225219 esql.query :
226220 body :
227221 query : ' FROM test-lookup-1 | LOOKUP JOIN test-lookup-alias-pattern-multiple ON key'
228222 catch : " bad_request"
229223
230224 - match : { error.type: "verification_exception" }
231- - contains : { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [2 ] indices" }
225+ - contains : { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [4 ] indices" }
232226
233227---
234228alias-pattern-single :
235- - skip :
236- awaits_fix : " LOOKUP JOIN does not support index aliases for now"
237229 - do :
238230 esql.query :
239231 body :
Original file line number Diff line number Diff line change 66 - method : POST
77 path : /_query
88 parameters : []
9- capabilities : [lookup_join_no_aliases ]
9+ capabilities : [enable_lookup_join_on_aliases ]
1010 reason : " uses LOOKUP JOIN"
1111
1212 - do :
3030 type : date
3131 x :
3232 type : keyword
33+ y :
34+ type : keyword
3335
3436 - do :
3537 indices.put_index_template :
@@ -40,29 +42,33 @@ setup:
4042 composed_of : [ "my_mappings", "my_settings" ]
4143 priority : 500
4244
45+ - do :
46+ indices.create_data_stream :
47+ name : my_data_stream
4348
4449 - do :
45- bulk :
46- index : " my_data_stream"
47- refresh : true
50+ index :
51+ index : my_data_stream
4852 body :
49- - { "index": { } }
50- - { "x": "foo", "y": "y1" }
51- - { "index": { } }
52- - { "x": "bar", "y": "y2" }
53-
54-
53+ ' @timestamp ' : ' 2020-12-12'
54+ ' x ' : ' foo'
55+ ' y ' : ' y1'
5556
57+ - do :
58+ indices.refresh :
59+ index : my_data_stream
5660---
57- " data streams not supported in LOOKUP JOIN " :
61+ " data streams supported in LOOKUP JOIN " :
5862 - do :
5963 esql.query :
6064 body :
61- query : ' row x = "foo" | LOOKUP JOIN my_data_stream ON x'
62- catch : " bad_request"
65+ query : ' ROW x = "foo" | LOOKUP JOIN my_data_stream ON x | KEEP x, y | LIMIT 1'
6366
64- - match : { error.type: "verification_exception" }
65- - contains : { error.reason: "Found 1 problem\nline 1:17: Aliases and index patterns are not allowed for LOOKUP JOIN [my_data_stream]" }
67+ - match : {columns.0.name: "x"}
68+ - match : {columns.0.type: "keyword"}
69+ - match : {columns.1.name: "y"}
70+ - match : {columns.1.type: "keyword"}
71+ - match : {values.0: ["foo", "y1"]}
6672
6773
6874
You can’t perform that action at this time.
0 commit comments