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

Please add the possibility to change the request method #1441

Closed
stefpe opened this issue Jan 17, 2018 · 5 comments
Closed

Please add the possibility to change the request method #1441

stefpe opened this issue Jan 17, 2018 · 5 comments

Comments

@stefpe
Copy link

stefpe commented Jan 17, 2018

Request::GET,

Currently the request method is hardcoded and I need to change it to be able to use a proxy. My current workaround is the following:

        $search = $this->indexType->createSearch($query);
//request via client, otherwise the path string generation will be prefixed again.
        $response = $this->indexType->getIndex()->getClient()->request(
            $search->getPath(),
            Request::POST,
            $search->getQuery()->toArray(),
            $options
        );
        $result = $search->getResultSetBuilder()->buildResultSet($response, $search->getQuery());

But what I actually wanted to do would be something like this:

$result = $this->indexType->search($query, $options, Request::POST);
@ruflin
Copy link
Owner

ruflin commented Jan 18, 2018

Can you share some details on why GET requests do not work with proxies? Because if that is the case, there are many other requests where this becomes an issue I would think.

@stefpe
Copy link
Author

stefpe commented Jan 26, 2018

Because in the HTTP Transport, you are setting
curl_setopt($conn, CURLOPT_POSTFIELDS, $content);
For elasticsearch somehow a GET Request with filled post body works, but a proxy which doesnt read the POST Body on a GET Request, you run into issues.

@ruflin
Copy link
Owner

ruflin commented Jan 28, 2018

Thanks for the details. I'm ok with adding this option. Can you open a PR?

In case the proxy is under your control, I think the proxy should be configured accordingly. But I can see the issue in case the proxy is not under your control.

I wonder what the proxy is that does not support it?

@ruflin
Copy link
Owner

ruflin commented Feb 6, 2018

@stefpe I just stumbled over this one: elastic/elasticsearch#28342 It seems the official high level client moved to POST, so I wonder if we should make this even the default?

@alamirault
Copy link
Contributor

PR is now merge, I think @ruflin you can close issue.

@ruflin ruflin closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants