Add TOP_SNIPPETS function to return the best snippets for a field#138940
Add TOP_SNIPPETS function to return the best snippets for a field#138940kderusso merged 19 commits intoelastic:mainfrom
Conversation
🔍 Preview links for changed docs |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
|
Hi @kderusso, I've created a changelog YAML for you. |
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
ioanatia
left a comment
There was a problem hiding this comment.
looks on the right track
...rc/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/TopSnippets.java
Show resolved
Hide resolved
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/common/chunks/MemoryIndexChunkScorer.java
Show resolved
Hide resolved
...rc/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/TopSnippets.java
Show resolved
Hide resolved
| public TopSnippets( | ||
| Source source, | ||
| @Param(name = "field", type = { "keyword", "text" }, description = "The input to chunk.") Expression field, | ||
| @Param(name = "query", type = { "keyword" }, description = "The query string to extract the best snippets for.") Expression query, |
There was a problem hiding this comment.
We need to be clear what kind of query this actually is. Query string seems like qstr but it isn't. Is this a match query? Is it qstr? Is it just a term query? Does it accept wildcards?
There was a problem hiding this comment.
Updated the docs, LMKWYT
benwtrent
left a comment
There was a problem hiding this comment.
looks ok to me. ESQL experts should review of course.
carlosdelest
left a comment
There was a problem hiding this comment.
Looks great! 🎉
We need to support NULL as a field, so we don't error out for multi index queries. Once that's done this is ready to go from my side.
Some other minor comments.
Adds a
TOP_SNIPPETSfunction to return the best snippets for a field.Example usage: