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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const aliases: Record<string, string[]> = {
STATS: ['STATS_BY', 'BY', 'STATS...BY', 'STATS ... BY'],
OPERATORS: ['LIKE', 'RLIKE', 'IN'],
JOIN: ['LOOKUP JOIN'],
LOOKUP_JOIN: ['LOOKUPJOIN'],
};

const getAliasMap = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export class EsqlDocumentBase {
}: GetDocsOptions = {}
) {
const keywords = rawKeywords.map((raw) => {
// LOOKUP JOIN has space so we want to retain as is
let keyword = raw.toLowerCase().includes('join') ? raw : format(raw);
let keyword = format(raw);
if (resolveAliases) {
keyword = tryResolveAlias(keyword);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,23 +740,21 @@ evaluate.describe('ES|QL query generation', { tag: '@svlOblt' }, () => {
},
metadata: {},
},
// This results in a timeout because the NL-to-ESQL tasks goes into a loop
// See trace: https://35-187-109-62.sslip.io/projects/UHJvamVjdDo5/traces/630f92adcb3620295794180f71ccb37a?selectedSpanNodeId=U3BhbjozODYxNTQ%3D
// {
// input: {
// question:
// "Assume user login data is logs-auth_service-*. The event action for user login is `login`. Generate an example query to fetch successful logins today and for each successful login, show the user's full name and department. The user meta data is in the users_metadata index.",
// },
// output: {
// expected: `FROM logs-auth_service-*
// | WHERE @timestamp >= NOW() - 1 day AND event.action == "login"
// | LOOKUP JOIN users_metadata ON user.id
// | KEEP @timestamp, user.id, full_name, department
// | LIMIT 20`,
// execute: false,
// },
// metadata: {},
// },
{
input: {
question:
"Assume user login data is logs-auth_service-*. The event action for user login is `login`. Generate an example query to fetch successful logins today and for each successful login, show the user's full name and department. The user meta data is in the users_metadata index.",
},
output: {
expected: `FROM logs-auth_service-*
| WHERE @timestamp >= NOW() - 1 day AND event.action == "login"
| LOOKUP JOIN users_metadata ON user.id
| KEEP @timestamp, user.id, full_name, department
| LIMIT 20`,
execute: false,
},
metadata: {},
},
],
},
});
Expand Down Expand Up @@ -979,7 +977,7 @@ evaluate.describe('ES|QL query generation', { tag: '@svlOblt' }, () => {
expected: [
`FROM main
| WHERE user_id IN (FROM suspicious_users | KEEP user_id)`,
`FROM main
`FROM main
| LOOKUP JOIN suspicious_users ON user_id`,
],
execute: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,7 @@ describe('ES|QL query generation', () => {
});
});

// This works on the Kibana UI but times out via the /chat/complete API
// See trace: https://35-187-109-62.sslip.io/projects/UHJvamVjdDo5/traces/630f92adcb3620295794180f71ccb37a?selectedSpanNodeId=U3BhbjozODYxNTQ%3D
it.skip('enriches login logs with user metadata using a lookup join', async () => {
it('enriches login logs with user metadata using a lookup join', async () => {
await evaluateEsqlQuery({
question:
"Assume user login data is logs-auth_service-*. The event action for user login is `login`. Generate an example query to fetch successful logins today and for each successful login, show the user's full name and department. The user meta data is in the users_metadata index.",
Expand Down Expand Up @@ -868,7 +866,7 @@ describe('ES|QL query generation', () => {
expected: [
`FROM main
| WHERE user_id IN (FROM suspicious_users | KEEP user_id)`,
`FROM main
`FROM main
| LOOKUP JOIN suspicious_users ON user_id`,
],
execute: false,
Expand Down