From 9d10872f967b3164994cb337990e3fce2401fb25 Mon Sep 17 00:00:00 2001 From: Panagiotis Bailis Date: Wed, 6 Nov 2024 12:13:45 +0200 Subject: [PATCH] adding capability for transforming rank rrf queries to the corresponding retriever --- .../rest/action/search/SearchCapabilities.java | 5 ++++- .../rest-api-spec/test/rrf/100_rank_rrf.yml | 8 ++++++-- .../test/rrf/150_rank_rrf_pagination.yml | 8 ++++++-- .../rest-api-spec/test/rrf/200_rank_rrf_script.yml | 13 ++++++++++--- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java b/server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java index 4efdfc66e8b5e..4836a94da1ce1 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java @@ -24,10 +24,13 @@ private SearchCapabilities() {} private static final String BIT_DENSE_VECTOR_SYNTHETIC_SOURCE_CAPABILITY = "bit_dense_vector_synthetic_source"; /** Support Byte and Float with Bit dot product. */ private static final String BYTE_FLOAT_BIT_DOT_PRODUCT_CAPABILITY = "byte_float_bit_dot_product"; + /** Support transforming rank rrf queries to the corresponding rrf retriever. */ + private static final String TRANSFORM_RANK_RRF_TO_RETRIEVER = "transform_rank_rrf_to_retriever"; public static final Set CAPABILITIES = Set.of( RANGE_REGEX_INTERVAL_QUERY_CAPABILITY, BIT_DENSE_VECTOR_SYNTHETIC_SOURCE_CAPABILITY, - BYTE_FLOAT_BIT_DOT_PRODUCT_CAPABILITY + BYTE_FLOAT_BIT_DOT_PRODUCT_CAPABILITY, + TRANSFORM_RANK_RRF_TO_RETRIEVER ); } diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/100_rank_rrf.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/100_rank_rrf.yml index 19b8e296d9cbd..a0e926a8e4bd8 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/100_rank_rrf.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/100_rank_rrf.yml @@ -1,7 +1,11 @@ setup: - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' + capabilities: + - method: POST + path: /_search + capabilities: [ transform_rank_rrf_to_retriever ] + test_runner_features: capabilities + reason: "Support for transforming deprecated rank_rrf queries to the corresponding rrf retriever is required" - skip: features: "warnings" diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/150_rank_rrf_pagination.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/150_rank_rrf_pagination.yml index 3c4dceecb4c52..7af6db611cd8c 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/150_rank_rrf_pagination.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/150_rank_rrf_pagination.yml @@ -5,8 +5,12 @@ setup: - contains - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' + capabilities: + - method: POST + path: /_search + capabilities: [ transform_rank_rrf_to_retriever ] + test_runner_features: capabilities + reason: "Support for transforming deprecated rank_rrf queries to the corresponding rrf retriever is required" - do: indices.create: diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/200_rank_rrf_script.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/200_rank_rrf_script.yml index 00a643a7dbbcd..1d74d7d67619a 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/200_rank_rrf_script.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/200_rank_rrf_script.yml @@ -1,8 +1,15 @@ setup: + - skip: + features: + - close_to + - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' - test_runner_features: "close_to" + capabilities: + - method: POST + path: /_search + capabilities: [ transform_rank_rrf_to_retriever ] + test_runner_features: capabilities + reason: "Support for transforming deprecated rank_rrf queries to the corresponding rrf retriever is required" - do: indices.create: