diff --git a/docs/changelog/128153.yaml b/docs/changelog/128153.yaml new file mode 100644 index 0000000000000..fda435438ff53 --- /dev/null +++ b/docs/changelog/128153.yaml @@ -0,0 +1,6 @@ +pr: 128153 +summary: "Fix: Add `NamedWriteable` for `RuleQueryRankDoc`" +area: Relevance +type: bug +issues: + - 126071 diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java index 0a96672aa2a30..1cdba56db96bf 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java @@ -29,6 +29,7 @@ import org.elasticsearch.plugins.SystemIndexPlugin; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestHandler; +import org.elasticsearch.search.rank.RankDoc; import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xpack.application.analytics.AnalyticsTemplateRegistry; import org.elasticsearch.xpack.application.analytics.action.DeleteAnalyticsCollectionAction; @@ -178,6 +179,7 @@ import org.elasticsearch.xpack.application.rules.action.TransportPutQueryRulesetAction; import org.elasticsearch.xpack.application.rules.action.TransportTestQueryRulesetAction; import org.elasticsearch.xpack.application.rules.retriever.QueryRuleRetrieverBuilder; +import org.elasticsearch.xpack.application.rules.retriever.RuleQueryRankDoc; import org.elasticsearch.xpack.application.search.SearchApplicationIndexService; import org.elasticsearch.xpack.application.search.action.DeleteSearchApplicationAction; import org.elasticsearch.xpack.application.search.action.GetSearchApplicationAction; @@ -358,6 +360,11 @@ public List getActions() { return Collections.unmodifiableList(actionHandlers); } + @Override + public List getNamedWriteables() { + return List.of(new NamedWriteableRegistry.Entry(RankDoc.class, RuleQueryRankDoc.NAME, RuleQueryRankDoc::new)); + } + @Override public List getRestHandlers( Settings settings, diff --git a/x-pack/plugin/ent-search/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml b/x-pack/plugin/ent-search/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml index 56106c66b063f..100b4f1aa4c27 100644 --- a/x-pack/plugin/ent-search/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml +++ b/x-pack/plugin/ent-search/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml @@ -903,10 +903,18 @@ teardown: - do: indices.create: index: test-index-001 + body: + settings: + index: + number_of_shards: 5 # Ensure more shards than docs - do: indices.create: index: test-index-002 + body: + settings: + index: + number_of_shards: 5 # Ensure more shards than docs - do: bulk: @@ -949,6 +957,7 @@ teardown: - do: search: + index: test-index-001,test-index-002 body: retriever: rule: