使用 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 构造函数接受templates
type 的可选参数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});