diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java index 7aed80fc481..bb59ff6051f 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalPlugin.java @@ -21,10 +21,13 @@ package org.elasticsearch.index.rankeval; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; +import org.elasticsearch.common.io.stream.NamedWriteable; +import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.rest.RestHandler; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -39,4 +42,16 @@ public class RankEvalPlugin extends Plugin implements ActionPlugin { public List> getRestHandlers() { return Arrays.asList(RestRankEvalAction.class); } + + /** + * Returns parsers for {@link NamedWriteable} this plugin will use over the transport protocol. + * @see NamedWriteableRegistry + */ + @Override + public List getNamedWriteables() { + List metrics = new ArrayList<>(); + metrics.add(new NamedWriteableRegistry.Entry(RankedListQualityMetric.class, PrecisionAtN.NAME, PrecisionAtN::new)); + metrics.add(new NamedWriteableRegistry.Entry(RankedListQualityMetric.class, ReciprocalRank.NAME, ReciprocalRank::new)); + return metrics; + } } diff --git a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/TransportRankEvalAction.java b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/TransportRankEvalAction.java index ee978b7823b..7b13014e310 100644 --- a/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/TransportRankEvalAction.java +++ b/modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/TransportRankEvalAction.java @@ -75,9 +75,6 @@ public class TransportRankEvalAction extends HandledTransportAction("aggregation"), new ParseFieldRegistry<>("aggregation_pipes")); - searchModule = new SearchModule(Settings.EMPTY, new NamedWriteableRegistry(), false, emptyList()); + searchModule = new SearchModule(Settings.EMPTY, false, emptyList()); queriesRegistry = searchModule.getQueryParserRegistry(); suggesters = searchModule.getSuggesters(); }