Skip to content
6 changes: 6 additions & 0 deletions docs/changelog/125230.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 125230
summary: Let `random_score` yaml test explicitly fail on `_id` field
area: Search
type: bug
issues:
- 125010
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,6 @@ tests:
- class: org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT
method: testLifecycleAppliedToFailureStore
issue: https://github.com/elastic/elasticsearch/issues/124999
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=search/610_function_score/Random}
issue: https://github.com/elastic/elasticsearch/issues/125010
- class: org.elasticsearch.packaging.test.DockerTests
method: test010Install
issue: https://github.com/elastic/elasticsearch/issues/119441
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
- match: { hits.total.value: 2 }

- do:
catch: /Fielddata access on the _id field is disallowed/
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 see how this improves things? I think we should block bwc testing. field is no longer necessary for v9: https://github.com/elastic/elasticsearch/pull/118671/files

I am not sure why this is failing at all. Is it failing in a mixed cluster? If so, we should adjust the assertions when hitting an older cluster vs v9.

But I do not like changing the test behavior like this. We are purposefully testing that not providing a field works. Let's continue to do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this test pass if we provide rest api compatibility?

Copy link
Contributor Author

@tteofili tteofili Mar 19, 2025

Choose a reason for hiding this comment

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

the thing is that the actual field being used underneath has changed from 8.x to 9.x (_id to _seqno), so the original idea was to make sure that this works across versions even when not supplying any field.
having an explicit test with _id should fail both on 8.x and 9.x (without explicitly enabling fielddata for _id), but I am fine with your suggestion of constraining the test to 9.x versions only.

Copy link
Member

Choose a reason for hiding this comment

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

The failure is that there is a deprecation warning indicating that "Hey, we will require you to provide a field in the future", which isn't the case any longer.

The user's API experience is largely unchanged, except now they do NOT get a deprecation warning.

Copy link
Member

Choose a reason for hiding this comment

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

AH, I see the test was added here: #124893

If we want this test to run in 8.x, we should have a separate one that is designed for 8.x that exercises the paths we expect there. But given that this test only exists in v9.0, maybe we only have it run there.

search:
index: test
body:
Expand All @@ -71,13 +72,11 @@
}
},
"random_score": {
"seed": 10
"seed": 10,
"field": "_id"
}
}

- length: { hits.hits: 2 }
- match: { hits.total.value: 2 }

- do:
search:
index: test
Expand Down
Loading