Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions docs/changelog/120354.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of these changelog should be added? We already should have the changelog for the scoring change, the others should not be needed (this should be a >non-issue IMO)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @carlosdelest , very good points !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #120940 to remove the mentioned assertions in tests

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 120354
summary: Move scoring in ES|QL out of snapshot
area: ES|QL
type: enhancement
issues: []
2 changes: 2 additions & 0 deletions docs/reference/esql/metadata-fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ supported ones are:
* <<mapping-ignored-field,`_ignored`>>: the ignored source document fields. The field is of the type
<<keyword,keyword>>.

* `_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>>.

To enable the access to these fields, the <<esql-from,`FROM`>> source command needs
to be provided with a dedicated directive:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ public enum Cap {
/**
* Support the "METADATA _score" directive to enable _score column.
*/
METADATA_SCORE(Build.current().isSnapshot()),
METADATA_SCORE,

/**
* Term function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.index.IndexMode;
import org.elasticsearch.transport.RemoteClusterAware;
import org.elasticsearch.xpack.esql.VerificationException;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.common.Failure;
import org.elasticsearch.xpack.esql.core.expression.Alias;
import org.elasticsearch.xpack.esql.core.expression.Attribute;
Expand Down Expand Up @@ -280,8 +279,7 @@ public LogicalPlan visitFromCommand(EsqlBaseParser.FromCommandContext ctx) {
for (var c : metadataOptionContext.UNQUOTED_SOURCE()) {
String id = c.getText();
Source src = source(c);
if (MetadataAttribute.isSupported(id) == false // TODO: drop check below once METADATA_SCORE is no longer snapshot-only
|| (EsqlCapabilities.Cap.METADATA_SCORE.isEnabled() == false && MetadataAttribute.SCORE.equals(id))) {
if (MetadataAttribute.isSupported(id) == false) {
throw new ParsingException(src, "unsupported metadata field [" + id + "]");
}
Attribute a = metadataMap.put(id, MetadataAttribute.create(src, id));
Expand Down