From 79f7e21411b5239b9586d92ffc247039ea000947 Mon Sep 17 00:00:00 2001 From: Tommaso Teofili Date: Thu, 20 Mar 2025 14:16:02 +0100 Subject: [PATCH 1/2] Let random_score yaml test explicitly fail on _id field (#125230) * constrain the no-field scenario to 9.x (cherry picked from commit 6d3dac32c673755c5280920961e9bbdcd18d5580) # Conflicts: # muted-tests.yml --- muted-tests.yml | 3 -- .../test/search/610_function_score.yml | 48 +++++++++++++++++-- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 3d95e42cb08b2..242c36e27be7b 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -258,9 +258,6 @@ tests: - class: org.elasticsearch.xpack.restart.MLModelDeploymentFullClusterRestartIT method: testDeploymentSurvivesRestart {cluster=OLD} issue: https://github.com/elastic/elasticsearch/issues/124160 -- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT - method: test {p0=search/610_function_score/Random} - issue: https://github.com/elastic/elasticsearch/issues/125010 # Examples: # diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml index 71591e13fd29a..53db9894c42d9 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml @@ -71,13 +71,55 @@ } }, "random_score": { - "seed": 10 + "seed": 10, + "field": "uuid" } } - length: { hits.hits: 2 } - match: { hits.total.value: 2 } +--- +"No field only runs on 9.x": + - requires: + cluster_features: [ "gte_v9.0.0" ] + reason: "empty field works seamlessly (relying on _seqno since 9.x)" + - do: + indices.create: + index: test + body: + mappings: + properties: + text: + type: text + + - do: + index: + index: test + id: "1" + body: { text: "foo bar", uuid: 1234 } + + - do: + index: + index: test + id: "2" + body: { text: "high bar", uuid: 5678 } + + - do: + index: + index: test + id: "3" + body: { text: "raise bar", uuid: 9012 } + + - do: + index: + index: test + id: "3" + body: { text: "raise hands", uuid: 3456 } + + - do: + indices.refresh: + index: [ test ] - do: search: index: test @@ -91,10 +133,8 @@ } }, "random_score": { - "seed": 10, - "field": "uuid" + "seed": 10 } } - - length: { hits.hits: 2 } - match: { hits.total.value: 2 } From bbb872966b714bf598fa707c8f8ebe045f4ca8a1 Mon Sep 17 00:00:00 2001 From: Tommaso Teofili Date: Mon, 24 Mar 2025 17:16:14 +0100 Subject: [PATCH 2/2] test fix - avoid synthetic cluster feature --- .../resources/rest-api-spec/test/search/610_function_score.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml index 53db9894c42d9..fddc02f3ea4c4 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/610_function_score.yml @@ -82,7 +82,7 @@ --- "No field only runs on 9.x": - requires: - cluster_features: [ "gte_v9.0.0" ] + cluster_features: [ "gte_v8.20.0" ] reason: "empty field works seamlessly (relying on _seqno since 9.x)" - do: indices.create: