Use type information in request

Adds parsing of type and actually using it in TransportRankEvalAction.

Missing: A good idea how to actually test this in isolation...
This commit is contained in:
Isabel Drost-Fromm 2016-07-27 15:49:37 +02:00
parent 2bb5cb83a7
commit ad9f060dc7
2 changed files with 6 additions and 0 deletions

View File

@ -225,10 +225,13 @@ public class RestRankEvalAction extends BaseRestHandler {
public static void parseRankEvalRequest(RankEvalRequest rankEvalRequest, RestRequest request, RankEvalContext context)
throws IOException {
List<String> indices = Arrays.asList(Strings.splitStringByCommaToArray(request.param("index")));
List<String> types = Arrays.asList(Strings.splitStringByCommaToArray(request.param("type")));
RankEvalSpec spec = PARSER.parse(context.parser(), context);
for (QuerySpec specification : spec.getSpecifications()) {
specification.setIndices(indices);
specification.setTypes(types);
};
rankEvalRequest.setRankEvalSpec(spec);
}
}

View File

@ -92,6 +92,9 @@ public class TransportRankEvalAction extends HandledTransportAction<RankEvalRequ
String[] indices = new String[spec.getIndices().size()];
spec.getIndices().toArray(indices);
SearchRequest templatedRequest = new SearchRequest(indices, specRequest);
String[] types = new String[spec.getTypes().size()];
spec.getTypes().toArray(types);
templatedRequest.types(types);
TransportSearchAction transportSearchAction = new TransportSearchAction(settings, threadPool, searchPhaseController,
transportService, searchTransportService, clusterService, actionFilters, indexNameExpressionResolver);