Skip to content
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
77101fc
Merge
tteofili Apr 11, 2025
819b364
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Apr 22, 2025
e2f774d
first chicken_score PoC
tteofili Apr 30, 2025
457aebe
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Apr 30, 2025
494f95e
first chicken_score PoC
tteofili Apr 30, 2025
8f38eb3
[CI] Auto commit changes from spotless
Apr 30, 2025
701fe46
more tests, minor fixes
tteofili May 2, 2025
0ed4f70
minor test fixes
tteofili May 2, 2025
bab8a4b
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili May 2, 2025
9e78a73
spotless
tteofili May 2, 2025
ddb40cd
improved tests
tteofili May 8, 2025
d1e2f1a
[CI] Auto commit changes from spotless
May 8, 2025
5ba09df
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 14, 2025
ec3b05a
missing readFrom
tteofili May 16, 2025
59ec292
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 21, 2025
d0c17a4
missing function wiring
tteofili May 21, 2025
b8001af
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili May 21, 2025
d6b2649
[CI] Auto commit changes from spotless
May 21, 2025
6944207
chicken_score --> score, fixed FTF checks and namedwritable reading
tteofili May 22, 2025
880ec89
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili May 22, 2025
994c9de
spotless
tteofili May 22, 2025
522bdfb
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 22, 2025
e8229e1
minor test fix
tteofili May 22, 2025
2edaef8
more tests
tteofili May 22, 2025
a15844d
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 22, 2025
f0d3b76
slightly better FTF check for EVAL s = score(...)
tteofili May 22, 2025
eac33c1
improved tests
tteofili May 22, 2025
bb78db6
spotless
tteofili May 22, 2025
68023d8
more tests
tteofili May 22, 2025
2200e15
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 22, 2025
2e0c9d6
verifier test fixes
tteofili May 22, 2025
d43d52e
[CI] Auto commit changes from spotless
May 22, 2025
14d763b
fixed info, test fixes
tteofili May 23, 2025
77f41ae
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili May 23, 2025
6356809
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 23, 2025
7e67a7b
minor refactoring
tteofili May 23, 2025
d4c2392
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 23, 2025
fa34213
enable score in WHERE with FTFs, more tests
tteofili May 23, 2025
e2ac064
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili May 23, 2025
0ccc315
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jun 5, 2025
1c0b575
spotless
tteofili Jun 5, 2025
52f8b3e
csv tests, minor adjustments
tteofili Jun 5, 2025
cce6f98
csv tests, minor adjustments
tteofili Jun 5, 2025
51c5427
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jun 5, 2025
4237ac7
Update docs/changelog/127551.yaml
tteofili Jun 5, 2025
80cf204
dropped old todo
tteofili Jun 5, 2025
bb60241
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili Jun 5, 2025
28568a4
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jun 10, 2025
9e01d7b
reset
tteofili Jun 10, 2025
141ec72
Delete docs/changelog/127551.yaml
tteofili Jun 10, 2025
ac3b001
removed changelog (unneeded)
tteofili Jun 10, 2025
5ed05c9
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili Jun 10, 2025
31db011
Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/…
tteofili Jun 26, 2025
36959c8
Update x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsea…
tteofili Jun 26, 2025
979c615
Merge branch 'main' into esql_namedqueries
tteofili Jun 26, 2025
e125cbe
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jun 30, 2025
62817f4
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jul 1, 2025
df01c8a
revert unwanted changes
tteofili Jul 1, 2025
ee51465
restore
tteofili Jul 1, 2025
25e9d4c
only run esql spec IT
tteofili Jul 2, 2025
df3f8ac
csv test fixes
tteofili Jul 3, 2025
0c46574
[CI] Auto commit changes from spotless
Jul 3, 2025
28848db
csv test fixes
tteofili Jul 3, 2025
e19ea6b
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili Jul 3, 2025
177b9f3
csv test fixes
tteofili Jul 3, 2025
1bec8d6
csv test fixes
tteofili Jul 3, 2025
45e96bb
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jul 3, 2025
d91cf10
data type fix
tteofili Jul 3, 2025
d121042
dropped test
tteofili Jul 3, 2025
6060f84
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jul 10, 2025
10edc05
improved checks and tests
tteofili Jul 11, 2025
0d7ecd1
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jul 11, 2025
afc1287
[CI] Auto commit changes from spotless
Jul 11, 2025
f0cd402
check score is always used before limit, aggs, etc.
tteofili Jul 11, 2025
eb14196
Merge branch 'esql_namedqueries' of github.com:tteofili/elasticsearch…
tteofili Jul 11, 2025
b964313
spotless
tteofili Jul 11, 2025
f4dfa0a
non pushable disjunction csv test
tteofili Jul 11, 2025
88997d9
minor fix
tteofili Jul 11, 2025
97822b3
minor fix
tteofili Jul 11, 2025
86287a9
minor fix
tteofili Jul 11, 2025
852fb22
minor fix
tteofili Jul 11, 2025
c941ea7
Merge branch 'main' of github.com:elastic/elasticsearch into esql_nam…
tteofili Jul 14, 2025
e888da2
ScoreTests and docs
tteofili Jul 14, 2025
398aa7c
revert
tteofili Jul 14, 2025
18df6f0
Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/…
tteofili Jul 15, 2025
87bce59
Merge branch 'main' into esql_namedqueries
tteofili Jul 15, 2025
c0e6258
[CI] Auto commit changes from spotless
Jul 15, 2025
c852c81
Merge branch 'main' into esql_namedqueries
tteofili Jul 15, 2025
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
6 changes: 6 additions & 0 deletions docs/changelog/127551.yaml
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
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
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
;
Loading
Loading