Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,18 +507,6 @@ tests:
- class: org.elasticsearch.index.store.DirectIOIT
method: testDirectIOUsed
issue: https://github.com/elastic/elasticsearch/issues/128829
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
method: test {p0=esql/190_lookup_join/alias-repeated-index}
issue: https://github.com/elastic/elasticsearch/issues/128849
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
method: test {p0=esql/190_lookup_join/alias-repeated-alias}
issue: https://github.com/elastic/elasticsearch/issues/128850
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
method: test {p0=esql/190_lookup_join/alias-pattern-single}
issue: https://github.com/elastic/elasticsearch/issues/128855
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
method: test {p0=esql/191_lookup_join_on_datastreams/data streams supported in LOOKUP JOIN}
issue: https://github.com/elastic/elasticsearch/issues/128856
- class: org.elasticsearch.upgrades.IndexSortUpgradeIT
method: testIndexSortForNumericTypes {upgradedNodes=3}
issue: https://github.com/elastic/elasticsearch/issues/128861
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ public enum Cap {
/**
* Enable support for index aliases in lookup joins
*/
ENABLE_LOOKUP_JOIN_ON_ALIASES(JOIN_LOOKUP_V12.isEnabled());
ENABLE_LOOKUP_JOIN_ON_ALIASES;

private final boolean enabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void writeTo(StreamOutput out) throws IOException {
|| out.getTransportVersion().isPatchFrom(TransportVersions.JOIN_ON_ALIASES_8_19)) {
out.writeString(indexPattern);
} else if (indexPattern.equals(shardId.getIndexName()) == false) {
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN []", indexPattern);
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN [{}]", indexPattern);
}

out.writeString(inputDataType.typeName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ setup:
- method: POST
path: /_query
parameters: []
capabilities: [join_lookup_v12, enable_lookup_join_on_aliases]
capabilities: [join_lookup_v12]
reason: "uses LOOKUP JOIN"
- do:
indices.create:
Expand Down Expand Up @@ -80,19 +80,6 @@ setup:
type: long
color:
type: keyword
- do:
indices.update_aliases:
body:
actions:
- add:
index: test-lookup-1
alias: test-lookup-alias
- add:
index: test-lookup-*
alias: test-lookup-alias-pattern-multiple
- add:
index: test-lookup-1*
alias: test-lookup-alias-pattern-single
- do:
bulk:
index: "test"
Expand Down Expand Up @@ -168,76 +155,6 @@ non-lookup index:
- match: { error.type: "verification_exception" }
- contains: { error.reason: "Found 1 problem\nline 1:45: invalid [test] resolution in lookup mode to an index in [standard] mode" }

---

"Alias as lookup index":
- skip:
awaits_fix: "LOOKUP JOIN does not support index aliases for now"
- do:
esql.query:
body:
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-repeated-alias:
- do:
esql.query:
body:
query: 'FROM test-lookup-alias | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-repeated-index:
- do:
esql.query:
body:
query: 'FROM test-lookup-1 | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-pattern-multiple:
- do:
esql.query:
body:
query: 'FROM test-lookup-1 | LOOKUP JOIN test-lookup-alias-pattern-multiple ON key'
catch: "bad_request"

- match: { error.type: "verification_exception" }
- contains: { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [4] indices" }

---
alias-pattern-single:
- do:
esql.query:
body:
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias-pattern-single ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
pattern-multiple:
- do:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
---
setup:
- requires:
test_runner_features: [capabilities, contains, allowed_warnings]
capabilities:
- method: POST
path: /_query
parameters: []
capabilities: [enable_lookup_join_on_aliases]
reason: "uses LOOKUP JOIN on aliases"
- do:
indices.create:
index: test
body:
mappings:
properties:
key:
type: long
color:
type: keyword
- do:
indices.create:
index: test-mv
body:
mappings:
properties:
key:
type: long
color:
type: keyword
- do:
indices.create:
index: test-lookup-1
body:
settings:
index:
mode: lookup
mappings:
properties:
key:
type: long
color:
type: keyword
- do:
indices.create:
index: test-lookup-2
body:
settings:
index:
mode: lookup
mappings:
properties:
key:
type: long
color:
type: keyword
- do:
indices.create:
index: test-lookup-mv
body:
settings:
index:
mode: lookup
mappings:
properties:
key:
type: long
color:
type: keyword
- do:
indices.create:
index: test-lookup-no-key
body:
settings:
index:
mode: lookup
mappings:
properties:
no-key:
type: long
color:
type: keyword
- do:
indices.update_aliases:
body:
actions:
- add:
index: test-lookup-1
alias: test-lookup-alias
- add:
index: test-lookup-*
alias: test-lookup-alias-pattern-multiple
- add:
index: test-lookup-1*
alias: test-lookup-alias-pattern-single
- do:
bulk:
index: "test"
refresh: true
body:
- { "index": { } }
- { "key": 1, "color": "red" }
- { "index": { } }
- { "key": 2, "color": "blue" }
- do:
bulk:
index: "test-lookup-1"
refresh: true
body:
- { "index": { } }
- { "key": 1, "color": "cyan" }
- { "index": { } }
- { "key": 2, "color": "yellow" }
- do:
bulk:
index: "test-mv"
refresh: true
body:
- { "index": { } }
- { "key": 1, "color": "red" }
- { "index": { } }
- { "key": 2, "color": "blue" }
- { "index": { } }
- { "key": [0, 1, 2], "color": null }
- do:
bulk:
index: "test-lookup-mv"
refresh: true
body:
- { "index": { } }
- { "key": 1, "color": "cyan" }
- { "index": { } }
- { "key": 2, "color": "yellow" }
- { "index": { } }
- { "key": [0, 1, 2], "color": "green" }
- do:
bulk:
index: "test-lookup-no-key"
refresh: true
body:
- { "index": { } }
- { "no-key": 1, "color": "cyan" }
- { "index": { } }
- { "no-key": 2, "color": "yellow" }

---
alias-as-lookup-index:
- do:
esql.query:
body:
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-repeated-alias:
- do:
esql.query:
body:
query: 'FROM test-lookup-alias | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-repeated-index:
- do:
esql.query:
body:
query: 'FROM test-lookup-1 | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}

---
alias-pattern-multiple:
- do:
esql.query:
body:
query: 'FROM test-lookup-1 | LOOKUP JOIN test-lookup-alias-pattern-multiple ON key'
catch: "bad_request"

- match: { error.type: "verification_exception" }
- contains: { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [4] indices" }

---
alias-pattern-single:
- do:
esql.query:
body:
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias-pattern-single ON key | LIMIT 3'

- match: {columns.0.name: "key"}
- match: {columns.0.type: "long"}
- match: {columns.1.name: "color"}
- match: {columns.1.type: "keyword"}
- match: {values.0: [1, "cyan"]}
- match: {values.1: [2, "yellow"]}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ tasks.named("yamlRestTest").configure {
'^esql/190_lookup_join/*',
'^esql/191_lookup_join_on_datastreams/*',
'^esql/191_lookup_join_text/*',
'^esql/192_lookup_join_on_aliases/*',
'^health/10_usage/*',
'^ilm/10_basic/Test Undeletable Policy In Use',
'^ilm/20_move_to_step/*',
Expand Down