Make RestSearchAction#parseSearchXXX(RestRequest) public
When building a plugin with a new search endpoint, you need to parse the request as a searchRequest. Methods exist in RestSearchAction class but are private. We will modify them to be public static. This applies to: * `RestSearchAction#parseSearchRequest(RestRequest)` * `RestSearchAction#parseSearchSource(RestRequest)` Closes #3499.
This commit is contained in:
parent
e111a7da62
commit
328608f55f
|
@ -68,7 +68,7 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||
SearchRequest searchRequest;
|
||||
try {
|
||||
searchRequest = parseSearchRequest(request);
|
||||
searchRequest = RestSearchAction.parseSearchRequest(request);
|
||||
searchRequest.listenerThreaded(false);
|
||||
SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null);
|
||||
if (operationThreading != null) {
|
||||
|
@ -118,7 +118,7 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
});
|
||||
}
|
||||
|
||||
private SearchRequest parseSearchRequest(RestRequest request) {
|
||||
public static SearchRequest parseSearchRequest(RestRequest request) {
|
||||
String[] indices = RestActions.splitIndices(request.param("index"));
|
||||
SearchRequest searchRequest = new SearchRequest(indices);
|
||||
// get the content, and put it in the body
|
||||
|
@ -150,7 +150,7 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
return searchRequest;
|
||||
}
|
||||
|
||||
private SearchSourceBuilder parseSearchSource(RestRequest request) {
|
||||
public static SearchSourceBuilder parseSearchSource(RestRequest request) {
|
||||
SearchSourceBuilder searchSourceBuilder = null;
|
||||
String queryString = request.param("q");
|
||||
if (queryString != null) {
|
||||
|
|
Loading…
Reference in New Issue