'Construct RankEval Request w/ Template Java Elasticsearch RestHighLevelClient
Using the 7.13.0 elasticsearch client I am able to run queries using the RankEvalRequest when I do not include the optional template parameter.
RankEvalSpec specification = new RankEvalSpec(
new RatedRequest("id", docRanking, query),
new MeanReciprocalRank(1, 10)
);
RankEvalRequest = new RankEvalRequest(specification, new String[]{myIndex});
The RankEvalSpec constructor accepts an optional templates parameter of the type Collection<ScriptWithId>. But that ScriptWithId class is private to the RankEvalSpec. How can I create a RankEvalRequest that includes a set of templates?
Without the public ScriptWithId class I am not able to do this:
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});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
