Skip to content

Commit b335c1a

Browse files
kderussoelasticsearchmachine
andauthored
Fix: Add NamedWriteable for RuleQueryRankDoc (#128153)
* Add NamedWriteable for QueryRule rank doc * Update test * Update docs/changelog/128153.yaml * Add multi cluster test for query rules * Commenting out code - explicitly trying to spur a test failure * [CI] Auto commit changes from spotless * Streamline test for multi cluster * Revert changes to try to break test * Fix compile error --------- Co-authored-by: elasticsearchmachine <[email protected]>
1 parent bc45087 commit b335c1a

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs/changelog/128153.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 128153
2+
summary: "Fix: Add `NamedWriteable` for `RuleQueryRankDoc`"
3+
area: Relevance
4+
type: bug
5+
issues:
6+
- 126071

x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearch.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.elasticsearch.plugins.SystemIndexPlugin;
3030
import org.elasticsearch.rest.RestController;
3131
import org.elasticsearch.rest.RestHandler;
32+
import org.elasticsearch.search.rank.RankDoc;
3233
import org.elasticsearch.xcontent.ParseField;
3334
import org.elasticsearch.xpack.application.analytics.AnalyticsTemplateRegistry;
3435
import org.elasticsearch.xpack.application.analytics.action.DeleteAnalyticsCollectionAction;
@@ -178,6 +179,7 @@
178179
import org.elasticsearch.xpack.application.rules.action.TransportPutQueryRulesetAction;
179180
import org.elasticsearch.xpack.application.rules.action.TransportTestQueryRulesetAction;
180181
import org.elasticsearch.xpack.application.rules.retriever.QueryRuleRetrieverBuilder;
182+
import org.elasticsearch.xpack.application.rules.retriever.RuleQueryRankDoc;
181183
import org.elasticsearch.xpack.application.search.SearchApplicationIndexService;
182184
import org.elasticsearch.xpack.application.search.action.DeleteSearchApplicationAction;
183185
import org.elasticsearch.xpack.application.search.action.GetSearchApplicationAction;
@@ -358,6 +360,11 @@ public List<ActionHandler> getActions() {
358360
return Collections.unmodifiableList(actionHandlers);
359361
}
360362

363+
@Override
364+
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
365+
return List.of(new NamedWriteableRegistry.Entry(RankDoc.class, RuleQueryRankDoc.NAME, RuleQueryRankDoc::new));
366+
}
367+
361368
@Override
362369
public List<RestHandler> getRestHandlers(
363370
Settings settings,

x-pack/plugin/ent-search/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/40_rule_query_search.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,10 +903,18 @@ teardown:
903903
- do:
904904
indices.create:
905905
index: test-index-001
906+
body:
907+
settings:
908+
index:
909+
number_of_shards: 5 # Ensure more shards than docs
906910

907911
- do:
908912
indices.create:
909913
index: test-index-002
914+
body:
915+
settings:
916+
index:
917+
number_of_shards: 5 # Ensure more shards than docs
910918

911919
- do:
912920
bulk:
@@ -949,6 +957,7 @@ teardown:
949957

950958
- do:
951959
search:
960+
index: test-index-001,test-index-002
952961
body:
953962
retriever:
954963
rule:

0 commit comments

Comments
 (0)