-
Couldn't load subscription status.
- Fork 25.6k
retain the scores of portions of an ES|QL query, via a score function #127551
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
Merged
Merged
Changes from 47 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
77101fc
Merge
tteofili 819b364
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili e2f774d
first chicken_score PoC
tteofili 457aebe
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 494f95e
first chicken_score PoC
tteofili 8f38eb3
[CI] Auto commit changes from spotless
701fe46
more tests, minor fixes
tteofili 0ed4f70
minor test fixes
tteofili bab8a4b
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 9e78a73
spotless
tteofili ddb40cd
improved tests
tteofili d1e2f1a
[CI] Auto commit changes from spotless
5ba09df
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili ec3b05a
missing readFrom
tteofili 59ec292
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili d0c17a4
missing function wiring
tteofili b8001af
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili d6b2649
[CI] Auto commit changes from spotless
6944207
chicken_score --> score, fixed FTF checks and namedwritable reading
tteofili 880ec89
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 994c9de
spotless
tteofili 522bdfb
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili e8229e1
minor test fix
tteofili 2edaef8
more tests
tteofili a15844d
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili f0d3b76
slightly better FTF check for EVAL s = score(...)
tteofili eac33c1
improved tests
tteofili bb78db6
spotless
tteofili 68023d8
more tests
tteofili 2200e15
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 2e0c9d6
verifier test fixes
tteofili d43d52e
[CI] Auto commit changes from spotless
14d763b
fixed info, test fixes
tteofili 77f41ae
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 6356809
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 7e67a7b
minor refactoring
tteofili d4c2392
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili fa34213
enable score in WHERE with FTFs, more tests
tteofili e2ac064
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 0ccc315
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 1c0b575
spotless
tteofili 52f8b3e
csv tests, minor adjustments
tteofili cce6f98
csv tests, minor adjustments
tteofili 51c5427
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 4237ac7
Update docs/changelog/127551.yaml
tteofili 80cf204
dropped old todo
tteofili bb60241
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 28568a4
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 9e01d7b
reset
tteofili 141ec72
Delete docs/changelog/127551.yaml
tteofili ac3b001
removed changelog (unneeded)
tteofili 5ed05c9
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 31db011
Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/…
tteofili 36959c8
Update x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsea…
tteofili 979c615
Merge branch 'main' into esql_namedqueries
tteofili e125cbe
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 62817f4
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili df01c8a
revert unwanted changes
tteofili ee51465
restore
tteofili 25e9d4c
only run esql spec IT
tteofili df3f8ac
csv test fixes
tteofili 0c46574
[CI] Auto commit changes from spotless
28848db
csv test fixes
tteofili e19ea6b
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili 177b9f3
csv test fixes
tteofili 1bec8d6
csv test fixes
tteofili 45e96bb
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili d91cf10
data type fix
tteofili d121042
dropped test
tteofili 6060f84
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili 10edc05
improved checks and tests
tteofili 0d7ecd1
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili afc1287
[CI] Auto commit changes from spotless
f0cd402
check score is always used before limit, aggs, etc.
tteofili eb14196
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili b964313
spotless
tteofili f4dfa0a
non pushable disjunction csv test
tteofili 88997d9
minor fix
tteofili 97822b3
minor fix
tteofili 86287a9
minor fix
tteofili 852fb22
minor fix
tteofili c941ea7
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili e888da2
ScoreTests and docs
tteofili 398aa7c
revert
tteofili 18df6f0
Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/…
tteofili 87bce59
Merge branch 'main' into esql_namedqueries
tteofili c0e6258
[CI] Auto commit changes from spotless
c852c81
Merge branch 'main' into esql_namedqueries
tteofili File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| pr: 127551 | ||
| summary: "Retain the scores of portions of an ES|QL query, via a score function" | ||
| area: ES|QL | ||
| type: enhancement | ||
| issues: | ||
| - 120082 | ||
125 changes: 125 additions & 0 deletions
125
x-pack/plugin/esql/qa/testFixtures/src/main/resources/score-function.csv-spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| ############################################### | ||
| # Tests for Score function | ||
| # | ||
|
|
||
| scoreSingle | ||
| required_capability: metadata_score | ||
| required_capability: score_function | ||
|
|
||
| // tag::score-single[] | ||
| FROM books METADATA _score | ||
| | WHERE match(title, "Return") AND match(author, "Tolkien") | ||
| | EVAL first_score = score(match(title, "Return")) | ||
| // end::score-single[] | ||
| | KEEP book_no, author, _score, first_score | ||
| | SORT book_no | ||
| | LIMIT 5 | ||
| ; | ||
|
|
||
| // tag::score-single-result[] | ||
| book_no:keyword | author:text | _score:double | first _score:double | ||
tteofili marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 2714 | Return of the King Being the Third Part of The Lord of the Rings | 0 | 0 | ||
| 7350 | Return of the Shadow | 0 | 0 | ||
| // end::score-single-result[] | ||
| ; | ||
|
|
||
| scoreSingleNoMetadata | ||
| required_capability: metadata_score | ||
| required_capability: score_function | ||
|
|
||
| FROM books | ||
| | WHERE match(title, "Return") AND match(author, "Tolkien") | ||
| | EVAL first_score = score(match(title, "Return")) | ||
| | KEEP book_no, author, first_score | ||
| | SORT book_no | ||
| | LIMIT 5 | ||
| ; | ||
|
|
||
| book_no:keyword | author:text | first _score:double | ||
| 2714 | Return of the King Being the Third Part of The Lord of the Rings | 0 | ||
| 7350 | Return of the Shadow | 0 | ||
| ; | ||
|
|
||
| scoreWithQueryExpressions | ||
| required_capability: score_function | ||
| required_capability: metadata_score | ||
|
|
||
| from books | ||
| FROM books METADATA _score | ||
| | WHERE match(title, "Return") AND match(author, "Tolkien") | ||
| | EVAL first_score = score(match(title, CONCAT("Return ", " King"))) | ||
| | keep book_no, title; | ||
| ignoreOrder:true | ||
|
|
||
| book_no:keyword | title:text | _score:double | first _score:double | ||
| 2714 | Return of the King Being the Third Part of The Lord of the Rings | 0 | 0 | ||
| 7350 | Return of the Shadow | 0 | 0 | ||
| ; | ||
|
|
||
| scoreAfterEval | ||
| required_capability: score_function | ||
| required_capability: metadata_score | ||
|
|
||
| from books METADATA _score | ||
| | eval stars = to_long(ratings / 2.0) | ||
| | eval s1 = score(match(author, "William")) | ||
| | where match(author, "Faulkner") | ||
| | sort book_no | ||
| | keep book_no, author, stars, s1 | ||
| | limit 5; | ||
|
|
||
| book_no:keyword | author:text | stars:long | s1:double | ||
| 2378 | [Carol Faulkner, Holly Byers Ochoa, Lucretia Mott] | 3 | 0.0 | ||
| 2713 | William Faulkner | 2 | 0.9 | ||
| 2847 | Colleen Faulkner | 3 | 0.0 | ||
| 2883 | William Faulkner | 2 | 0.9 | ||
| 3293 | Danny Faulkner | 2 | 0.0 | ||
| ; | ||
|
|
||
| matchWithConjunction | ||
| required_capability: score_function | ||
| required_capability: metadata_score | ||
|
|
||
| from books | ||
| | eval s1 = score(match(title, "Rings") and ratings > 4.6) | ||
| | keep book_no, title, s1; | ||
| ignoreOrder:true | ||
|
|
||
| book_no:keyword | title:text |s1:double | ||
| 4023 |A Tolkien Compass: Including J. R. R. Tolkien's Guide to the Names in The Lord of the Rings | 0.0 | ||
| 7140 |The Lord of the Rings Poster Collection: Six Paintings by Alan Lee (No. 1) | 0.0 | ||
| ; | ||
|
|
||
| scoreWithDisjunction | ||
| required_capability: metadata_score | ||
| required_capability: score_function | ||
|
|
||
| from books | ||
| | eval s1 = score(match(author, "Vonnegut") or match(author, "Guinane")) | ||
| | where match(author, "Vonnegut") | ||
| | keep book_no, author, s1; | ||
| ignoreOrder:true | ||
|
|
||
| book_no:keyword | author:text | s1:double | ||
| 2464 | Kurt Vonnegut | 0.0 | ||
| 6970 | Edith Vonnegut | 0.0 | ||
| 8956 | Kurt Vonnegut | 0.0 | ||
| 3950 | Kurt Vonnegut | 0.0 | ||
| ; | ||
|
|
||
| matchWithDisjunctionAndFiltersConjunction | ||
| required_capability: match_function | ||
| required_capability: full_text_functions_disjunctions | ||
|
|
||
| from books | ||
| | eval s1 = score((match(author, "Vonnegut") or match(author, "Guinane")) and year > 1997) | ||
| | where match(author, "Vonnegut") | ||
| | keep book_no, author, year, s1; | ||
| ignoreOrder:true | ||
|
|
||
| book_no:keyword | author:text | year:integer | s1:double | ||
| 2464 | Kurt Vonnegut | 1998 | 0.0 | ||
| 6970 | Edith Vonnegut | 1998 | 0.0 | ||
| 8956 | Kurt Vonnegut | 1998 | 0.0 | ||
| 3950 | Kurt Vonnegut | 1998 | 0.0 | ||
| ; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.