I'm trying to adjust settings on ElasticSearch with Planck. ElasticSearch wants a JSON blob on a PUT request. How would I format this appropriately with planck.http/put
?
This is the curl equivalent:
curl -XPUT '<http://localhost:9200/_cluster/settings>' -d '{… blob …}'
@henrik If you do the following curl
command (specifying JSON content type)
curl -XPUT '<http://localhost:9200/_cluster/settings>' -H "Content-Type: application/json" -d '{:foo 1}'
then the equivalent in Planck would be:
(planck.http/put "<http://localhost:9200/_cluster/settings>" {:content-type "application/json" :body "{foo: 1}"})
Otherwise, curl
is actually sending a content-type of application/x-www-form-urlencoded
, and in that case a curl
request like
curl -XPUT '<http://localhost:9200/_cluster/settings>' -d 'foo=1'
has the following equivalent in Planck:
(http/put "<http://localhost:9200/_cluster/settings>" {:form-params {:foo 1}})
(But I suspect you really want to work with JSON given your description.)Cool! I didn't see in the docs that you could set :body
explicitly. Thank you!
Actually, my bad, it's in the spec.