Skip to content

Commit

Permalink
scroll REST API should support source parameter
Browse files Browse the repository at this point in the history
As stated in documentation, we should support `?source=` parameter in `/_search/scroll` REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"
curl -XPOST "http://localhost:9200/test/type/1" -d'
{
    "foo": "bar"
}'

# This one works
curl -XPOST "http://localhost:9200/_search/scroll" -d "FAKESCROLLID"

# This one gives: {"error":"Failed to derive xcontent from org.elasticsearch.common.bytes.BytesArray@0"}
curl -XGET "http://localhost:9200/_search/scroll/?source=FAKESCROLLID"
```

Closes elastic#4941.
  • Loading branch information
dadoonet committed Jan 29, 2014
1 parent 2823361 commit a299950
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.search.Scroll;

import java.io.IOException;
Expand Down Expand Up @@ -56,8 +57,8 @@ public RestSearchScrollAction(Settings settings, Client client, RestController c
@Override
public void handleRequest(final RestRequest request, final RestChannel channel) {
String scrollId = request.param("scroll_id");
if (scrollId == null && request.hasContent()) {
scrollId = request.content().toUtf8();
if (scrollId == null) {
scrollId = RestActions.getRestContent(request).toUtf8();
}
SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId);
searchScrollRequest.listenerThreaded(false);
Expand Down

0 comments on commit a299950

Please sign in to comment.