Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit async search to work only with POST #53368

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected Settings restClientSettings() {
}

@Before
private void indexDocuments() throws IOException {
public void indexDocuments() throws IOException {
createIndex("index", Settings.EMPTY);
index("index", "0", "foo", "bar");
refresh("index");
Expand Down Expand Up @@ -122,12 +122,8 @@ static Response get(String index, String id, String user) throws IOException {
return client().performRequest(request);
}

static Response submitAsyncSearch(String indexName, String query, String user) throws IOException {
return submitAsyncSearch(indexName, query, TimeValue.MINUS_ONE, user);
}

static Response submitAsyncSearch(String indexName, String query, TimeValue waitForCompletion, String user) throws IOException {
final Request request = new Request("GET", indexName + "/_async_search");
final Request request = new Request("POST", indexName + "/_async_search");
setRunAsHeader(request, user);
request.addParameter("q", query);
request.addParameter("wait_for_completion", waitForCompletion.toString());
Expand All @@ -136,13 +132,6 @@ static Response submitAsyncSearch(String indexName, String query, TimeValue wait
return client().performRequest(request);
}

static Response search(String indexName, String query, String user) throws IOException {
final Request request = new Request("GET", indexName + "/_search");
setRunAsHeader(request, user);
request.addParameter("q", query);
return client().performRequest(request);
}

static Response getAsyncSearch(String id, String user) throws IOException {
final Request request = new Request("GET", "/_async_search/" + id);
setRunAsHeader(request, user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.IntConsumer;
import java.util.List;

import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.action.search.RestSearchAction.parseSearchRequest;

Expand All @@ -34,9 +33,7 @@ public final class RestSubmitAsyncSearchAction extends BaseRestHandler {
public List<Route> routes() {
return unmodifiableList(asList(
new Route(POST, "/_async_search"),
new Route(GET, "/_async_search"),
new Route(POST, "/{index}/_async_search"),
new Route(GET, "/{index}/_async_search")));
new Route(POST, "/{index}/_async_search")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
{
"path":"/_async_search",
"methods":[
"GET",
"POST"
]
},
{
"path":"/{index}/_async_search",
"methods":[
"GET",
"POST"
],
"parts":{
Expand Down