elasticsearch-head-chrome
elasticsearch-head-chrome copied to clipboard
Cannot send empty request body - empty request body is replaced to empty JSON object
_forcemerge
has changed in 6.4.0 - REST API: Reject forcemerge requests with a body https://github.com/elastic/elasticsearch/pull/30792 (issue: https://github.com/elastic/elasticsearch/issues/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.