-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[DOCS][ESQL] Cleanup and cross-reference LOOKUP JOIN reference and landing pages #127215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nding pages **lookup-join.md (syntax reference)**: - removed tip formatting for simpler direct link to landing page - improved parameter formatting and descriptions - fixed template variable from `{esql}` to `{{esql}}` **esql-lookup-join.md (landing page)**: - added "compare with enrich" section header - simplified "how the command works" with clearer parameter explanation - added code example in how it works section - improved image alt text for accessibility - organized example section with better context and SQL comparison - added dropdown for sample tables to reduce visual clutter - added "query" subheading for clearer organization - included reference to additional examples in command reference - removed excessive whitespace
Pinging @elastic/es-docs (Team:Docs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Liam! I have some minor remarks and suggestions, but otherwise this LGTM and it's a nice improvement over the previous version.
Please feel free to address the remarks at your own discretion.
Also, we probably want to manually backport (an adapted version of) this to the 8.18/8.x docs, right?
|
||
`<field_name>` | ||
: The field to join on. This field must exist in both your current query results and in the lookup index. If the field contains multi-valued entries, those entries will not match anything (the added fields will contain `null` for those rows). | ||
If you're familiar with SQL, `LOOKUP JOIN` has left-join behavior. This means that if no rows match in the lookup index, the incoming row is retained and `null`s are added. If many rows in the lookup index match, `LOOKUP JOIN` adds one row per match. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this paragraph be in the example section? It looks like it would fit better just above it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
|
||
`LOOKUP JOIN` has left-join behavior. If no rows match in the lookup index, `LOOKUP JOIN` retains the incoming row and adds `null`s. If many rows in the lookup index match, `LOOKUP JOIN` adds one row per match. | ||
In this example, we have two sample tables, `employees` and `languages_non_unique_key`. The `employees` table contains employee information, including their language code. The `languages_non_unique_key` table contains language codes and their corresponding names and countries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of scope: languages_non_unique_key
is a weird name for an index IMO; it makes sense in the context of the tests that this is taken from, but doesn't mean much to readers of this page, I think.
This extends to the example query below, which doesn't provide a meaningful example from real life. It'd be nicer to have an example that is intuitive for new users of this command.
The same applies to some of the examples in the reference entry (in lookup-join.md
) that were taken directly from our test. The threat hunting examples are much better, in contrast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I think we should just make the example on the landing page be super simple. I can do that in this PR. Then we can think about how to improve the examples in the reference entry in a follow up and/or think about more end-to-end tutorials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to blow the scope of this PR, but if you'd like to add a better example right away, that's great! I'm happy either way :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can work with what we have just make it a little clearer and user-friendly :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for folks following along decided to improve the example completely: 9d23f24
|
||
In this example, we have two sample tables: | ||
:::{dropdown} Show the sample tables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dropdown is great and looks much cleaner!
:::: | ||
|
||
### Additional examples | ||
|
||
Refer to the examples section of the [`LOOKUP JOIN`](/reference/query-languages/esql/commands/processing-commands.md#esql-lookup-join) command reference for more examples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
replaced abstract employee/language example with security monitoring use case added setup instructions for creating test indices included sample data loading via bulk api new practical query example joining firewall logs with threat data simplified results output showing threat detection scenario added note about left-join behavior improved code comments and structure added required index.mode: lookup setting info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much nicer example, thank you!
💚 Backport successful
|
…nding pages (elastic#127215) * [DOCS][ESQL] Cleanup and cross-reference LOOKUP JOIN reference and landing pages **lookup-join.md (syntax reference)**: - removed tip formatting for simpler direct link to landing page - improved parameter formatting and descriptions - fixed template variable from `{esql}` to `{{esql}}` **esql-lookup-join.md (landing page)**: - added "compare with enrich" section header - simplified "how the command works" with clearer parameter explanation - added code example in how it works section - improved image alt text for accessibility - organized example section with better context and SQL comparison - added dropdown for sample tables to reduce visual clutter - added "query" subheading for clearer organization - included reference to additional examples in command reference - removed excessive whitespace * Improve example, add setup code replaced abstract employee/language example with security monitoring use case added setup instructions for creating test indices included sample data loading via bulk api new practical query example joining firewall logs with threat data simplified results output showing threat detection scenario added note about left-join behavior improved code comments and structure added required index.mode: lookup setting info
…nding pages (#127215) (#127232) * [DOCS][ESQL] Cleanup and cross-reference LOOKUP JOIN reference and landing pages **lookup-join.md (syntax reference)**: - removed tip formatting for simpler direct link to landing page - improved parameter formatting and descriptions - fixed template variable from `{esql}` to `{{esql}}` **esql-lookup-join.md (landing page)**: - added "compare with enrich" section header - simplified "how the command works" with clearer parameter explanation - added code example in how it works section - improved image alt text for accessibility - organized example section with better context and SQL comparison - added dropdown for sample tables to reduce visual clutter - added "query" subheading for clearer organization - included reference to additional examples in command reference - removed excessive whitespace * Improve example, add setup code replaced abstract employee/language example with security monitoring use case added setup instructions for creating test indices included sample data loading via bulk api new practical query example joining firewall logs with threat data simplified results output showing threat detection scenario added note about left-join behavior improved code comments and structure added required index.mode: lookup setting info
- I trimmed the KEEP query in my final iteration in elastic#127215 but neglected to update the query itself, only the response. This fixes that so the query matches the response. - 🚘 I also updated the table response to match other ESQL response tables
- I trimmed the KEEP query in my final iteration in #127215 but neglected to update the query itself, only the response. This fixes that so the query matches the response. - 🚘 I also updated the table response to match other ESQL response tables
- I trimmed the KEEP query in my final iteration in elastic#127215 but neglected to update the query itself, only the response. This fixes that so the query matches the response. - 🚘 I also updated the table response to match other ESQL response tables
- I trimmed the KEEP query in my final iteration in #127215 but neglected to update the query itself, only the response. This fixes that so the query matches the response. - 🚘 I also updated the table response to match other ESQL response tables
Contributes to #126897
URL Previews
Summary
Main goal is to ensure both pages have clear distinctions and cross-reference each other.
lookup-join.md (syntax reference):
{esql}
to{{esql}}
esql-lookup-join.md (landing page):
9d23f24 adds improved example with setup code
improve layout: