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

Fix elasticsearch(>=7.11) does not support body in GET request #437

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tauh33dkhan
Copy link

Elasticsearch(>=7.11) does not support the body in GET request and returns an error message when making GET request with body such as the login request, For more details read this elasticsearch issue and the pull request that introduced this change 66043.

To fix this I made changes in the rootQuery function of elasticsearch driver to only send the request body and content-type header if the request method is not GET.

Fix tested on:

  • Elasticsearch Version: 7.14.0
  • Elasticsearch Version: 7.7.0

@peterpp
Copy link
Contributor

peterpp commented Sep 18, 2021

Condition for non-GET request is not sufficient in general. For example POST /_flush with empty body also fails.

The real problem is the default value $content = array() together with null checking:
$opts['http']['content'] = $content === null ? $content : json_encode($content);

I created a merge request for Elasic long time ago with multiple fixes and this is my solution for 7.14 compatibility:
920a11c

Than I created a new driver for Elasticsearch 7 (fix for 7.14 included) #440

@peterpp
Copy link
Contributor

peterpp commented Sep 20, 2024

As long as Adminer is not maintained anymore, you can find all my Elasticsearch fixes here: https://github.com/pematon/adminer

@tauh33dkhan
Copy link
Author

Thanks @peterpp

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

Successfully merging this pull request may close these issues.

2 participants