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

Comments

@stefpe
Copy link

@stefpe 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

This comment has been minimized.

Copy link
Owner

@ruflin 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

This comment has been minimized.

Copy link
Author

@stefpe 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

This comment has been minimized.

Copy link
Owner

@ruflin 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

This comment has been minimized.

Copy link
Owner

@ruflin 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 pushed a commit to alamirault/Elastica that referenced this issue Jun 30, 2019
alamirault pushed a commit to alamirault/Elastica that referenced this issue Jun 30, 2019
alamirault pushed a commit to alamirault/Elastica that referenced this issue Aug 15, 2019
ruflin added a commit that referenced this issue Aug 19, 2019
@alamirault

This comment has been minimized.

Copy link
Contributor

@alamirault alamirault commented Sep 23, 2019

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

@ruflin ruflin closed this Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.