Skip to content

Commit dc493f0

Browse files
committed
Move scoring in ES|QL out of snapshot
1 parent 2ee7ca4 commit dc493f0

File tree

4 files changed

+71
-72
lines changed

4 files changed

+71
-72
lines changed

docs/reference/esql/metadata-fields.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ supported ones are:
2020
* <<mapping-ignored-field,`_ignored`>>: the ignored source document fields. The field is of the type
2121
<<keyword,keyword>>.
2222

23+
* `_score`: when enabled, the final score assigned to each row matching an ES|QL query.
24+
2325
To enable the access to these fields, the <<esql-from,`FROM`>> source command needs
2426
to be provided with a dedicated directive:
2527

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Lines changed: 67 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ public enum Cap {
703703
/**
704704
* Support the "METADATA _score" directive to enable _score column.
705705
*/
706-
METADATA_SCORE(Build.current().isSnapshot()),
706+
METADATA_SCORE,
707707

708708
/**
709709
* Term function

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/LogicalPlanBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ public LogicalPlan visitFromCommand(EsqlBaseParser.FromCommandContext ctx) {
262262
for (var c : ctx.metadata().UNQUOTED_SOURCE()) {
263263
String id = c.getText();
264264
Source src = source(c);
265-
if (MetadataAttribute.isSupported(id) == false // TODO: drop check below once METADATA_SCORE is no longer snapshot-only
266-
|| (EsqlCapabilities.Cap.METADATA_SCORE.isEnabled() == false && MetadataAttribute.SCORE.equals(id))) {
265+
if (MetadataAttribute.isSupported(id) == false) {
267266
throw new ParsingException(src, "unsupported metadata field [" + id + "]");
268267
}
269268
Attribute a = metadataMap.put(id, MetadataAttribute.create(src, id));

0 commit comments

Comments
 (0)