0

使用 7.13.0 elasticsearch 客户端,当我不包含可选template参数时,我可以使用 RankEvalRequest 运行查询。

RankEvalSpec specification = new RankEvalSpec(
   new RatedRequest("id", docRanking, query),
   new MeanReciprocalRank(1, 10)
);
RankEvalRequest = new RankEvalRequest(specification, new String[]{myIndex});

RankEvalSpec 构造函数接受templatestype 的可选参数Collection<ScriptWithId>。但是ScriptWithId该类是RankEvalSpec私有的。如何创建包含一组模板的 RankEvalRequest?没有公共ScriptWithId课,我无法做到这一点:

Collection<ScriptWithId> templates = new HashMap<String, ScriptWithId>();
templates.put("TemplateID", new ScriptWithId("Script"));

RankEvalSpec specification = new RankEvalSpec(
   new RatedRequest("id", docRanking, query),
   new MeanReciprocalRank(1, 10),
   templates
);
RankEvalRequest = new RankEvalRequest(specification, new String[]{myIndex});
4

0 回答 0