Skip to content

Commit 791d4c1

Browse files
authored
Backport moving scoring in ES|QL out of snapshot into 8.x (#120905)
* Move scoring in ES|QL out of snapshot (#120354)
1 parent e2a664f commit 791d4c1

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

docs/changelog/120354.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120354
2+
summary: Move scoring in ES|QL out of snapshot
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

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. Scoring will be updated when using <<esql-search-functions,full text search functions>>.
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/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public enum Cap {
599599
/**
600600
* Support the "METADATA _score" directive to enable _score column.
601601
*/
602-
METADATA_SCORE(Build.current().isSnapshot()),
602+
METADATA_SCORE,
603603

604604
/**
605605
* Term function

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.index.IndexMode;
1919
import org.elasticsearch.transport.RemoteClusterAware;
2020
import org.elasticsearch.xpack.esql.VerificationException;
21-
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
2221
import org.elasticsearch.xpack.esql.common.Failure;
2322
import org.elasticsearch.xpack.esql.core.expression.Alias;
2423
import org.elasticsearch.xpack.esql.core.expression.Attribute;
@@ -280,8 +279,7 @@ public LogicalPlan visitFromCommand(EsqlBaseParser.FromCommandContext ctx) {
280279
for (var c : metadataOptionContext.UNQUOTED_SOURCE()) {
281280
String id = c.getText();
282281
Source src = source(c);
283-
if (MetadataAttribute.isSupported(id) == false // TODO: drop check below once METADATA_SCORE is no longer snapshot-only
284-
|| (EsqlCapabilities.Cap.METADATA_SCORE.isEnabled() == false && MetadataAttribute.SCORE.equals(id))) {
282+
if (MetadataAttribute.isSupported(id) == false) {
285283
throw new ParsingException(src, "unsupported metadata field [" + id + "]");
286284
}
287285
Attribute a = metadataMap.put(id, MetadataAttribute.create(src, id));

0 commit comments

Comments
 (0)