Skip to content

Conversation

leemthompo
Copy link
Contributor

@leemthompo leemthompo commented Mar 17, 2025

ESQL equivalent of existing tutorial + semantic search bonus

I had a bash at adding this to learn the new syntax, hopefully at least a few of the examples are correct 😄

👀 Live URL preview

@leemthompo leemthompo self-assigned this Mar 17, 2025
@leemthompo leemthompo changed the title [Search] Add ESQL equivalent for full-text search + filtering tutorial [Search] Add ESQL version of full-text search + filtering tutorial Mar 17, 2025
This tutorial presents examples in {{esql}} syntax. Refer to [the Query DSL version](querydsl-full-text-filter-tutorial.md) for the equivalent examples in Query DSL syntax.
:::

This is a hands-on introduction to the basics of [full-text search](full-text.md) with Elasticsearch, also known as *lexical search*, and how to filter search results based on exact criteria. In this scenario, we're implementing a search function for a cooking blog. The blog contains recipes with various attributes including textual content, categorical data, and numerical ratings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we focus primarily on lexical search. where do you think we should add a note on semantic search with match? If possible I would add a section on semantic search in this guide - can also be done as a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ioanatia happy to do it here. The first pass was just duplicating the existing tutorial but I agree that given the simplicity of working with semantic_text in the match workflow, why not add that here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leemthompo leemthompo marked this pull request as ready for review March 21, 2025 15:54
Copy link
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 💯

| EVAL category_boost = CASE(category.keyword == "Main Course", 1.0, 0.0) # Conditional boost
| EVAL date_boost = CASE(DATE_DIFF("month", date, NOW()) <= 1, 0.5, 0.0) # Boost recent content
| EVAL custom_score = _score + category_boost + date_boost # Combine scores
| WHERE NOT category.keyword == "Dessert"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should move this closer to FROM, so it doesn't interfere with score calculation but is part of the filtering part?

@leemthompo leemthompo enabled auto-merge (squash) March 21, 2025 17:35
@leemthompo leemthompo disabled auto-merge March 21, 2025 17:37
@leemthompo leemthompo enabled auto-merge (squash) March 21, 2025 17:40
@leemthompo leemthompo merged commit 4a1be8e into main Mar 21, 2025
3 of 4 checks passed
@leemthompo leemthompo deleted the leemthompo/esql-search branch March 21, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants