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

Cannot send empty request body - empty request body is replaced to empty JSON object #16

Open
krzotr opened this issue Nov 22, 2018 · 0 comments

Comments

@krzotr
Copy link

krzotr commented Nov 22, 2018

_forcemerge has changed in 6.4.0 - REST API: Reject forcemerge requests with a body elastic/elasticsearch#30792 (issue: elastic/elasticsearch#29584)

I use Elasticsearch 6.5.1. I try to manually run _forcemerge command on a specified index.

In that case, I go to Any Request tab, put test/_forcemerge?max_num_segments=1 in path field, select POST method, remove whole request body. After I press Request button I see Error 400 with message forcemerge takes arguments in query parameters, not in the request body.

The problem is _forcemerge does not allow to send a request body. Currentl,y empty body of request is replaced with empty JSON object {}), it must be empty!

Please check _forcemerge with curl requests.

Send empty JSON object instead of empty body - error

$ curl -H "Content-Type: application/json" -XPOST "http://192.168.1.27:9200/test/_forcemerge?max_num_segments=1" -d "{}"
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"forcemerge takes arguments in query parameters, not in the request body"}],"type":"illegal_argument_exception","reason":"forcemerge takes arguments in query parameters, not in the request body"},"status":400}

Send empty request body - everything is OK

$ curl -H "Content-Type: application/json" -XPOST "http://192.168.1.27:9200/test/_forcemerge?max_num_segments=1" -d ""
{"_shards":{"total":10,"successful":5,"failed":0}}

In my opinion to send empty request body should be checkbox Empty body next to Pretty. When Empty body is selected textarea form should be disabled.

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

1 participant