Context: https://github.com/elastic/elasticsearch/pull/22691
We should probably update all our docs to set Content-Type header in curl. Grepping I found 65 curl calls that use -d and dont' set a content type:
% ack curl docs | grep -- '-d'
docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc:49:curl -XPUT localhost:9200/test/ -d '
docs/reference/analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc:90:curl -XPUT localhost:9200/test/ -d '
docs/reference/cat/recovery.asciidoc:36:> curl -XPUT 'localhost:9200/wiki/_settings' -d'{"number_of_replicas":1}'
docs/reference/cat/shards.asciidoc:60:% curl -XPUT 192.168.56.20:9200/_settings -d'{"number_of_replicas":1}'
docs/reference/cat/shards.asciidoc:77:% curl -XPUT 192.168.56.20:9200/_settings -d'{"number_of_replicas":3}'
docs/reference/cluster/reroute.asciidoc:14:curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
docs/reference/cluster/update-settings.asciidoc:10:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/cluster/update-settings.asciidoc:21:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/cluster/update-settings.asciidoc:49:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/cluster/update-settings.asciidoc:72:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/cluster/allocation-explain.asciidoc:19:$ curl -XGET 'http://localhost:9200/_cluster/allocation/explain' -d '{
docs/reference/cluster/allocation-explain.asciidoc:37:$ curl -XGET 'http://localhost:9200/_cluster/allocation/explain' -d '{
docs/reference/docs/multi-get.asciidoc:12:curl 'localhost:9200/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:33:curl 'localhost:9200/test/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:51:curl 'localhost:9200/test/type/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:68:curl 'localhost:9200/test/type/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:88:curl 'localhost:9200/test/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:126:curl 'localhost:9200/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:163:curl 'localhost:9200/_mget' -d '{
docs/reference/docs/multi-get.asciidoc:186:curl 'localhost:9200/test/type/_mget?stored_fields=field1,field2' -d '{
docs/reference/docs/multi-get.asciidoc:214:curl 'localhost:9200/_mget?routing=key1' -d '{
docs/reference/docs/termvectors.asciidoc:127:curl -s -XPUT 'http://localhost:9200/twitter/' -d '{
docs/reference/docs/termvectors.asciidoc:170:curl -XPUT 'http://localhost:9200/twitter/tweet/1?pretty=true' -d '{
docs/reference/docs/termvectors.asciidoc:175:curl -XPUT 'http://localhost:9200/twitter/tweet/2?pretty=true' -d '{
docs/reference/docs/termvectors.asciidoc:187:curl -XGET 'http://localhost:9200/twitter/tweet/1/_termvectors?pretty=true' -d '{
docs/reference/docs/termvectors.asciidoc:271:curl -XGET 'http://localhost:9200/twitter/tweet/1/_termvectors?pretty=true' -d '{
docs/reference/docs/termvectors.asciidoc:296:curl -XGET 'http://localhost:9200/twitter/tweet/_termvectors' -d '{
docs/reference/docs/termvectors.asciidoc:317:curl -XGET 'http://localhost:9200/twitter/tweet/_termvectors' -d '{
docs/reference/docs/bulk.asciidoc:59:$ curl -s -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
docs/reference/docs/multi-termvectors.asciidoc:15:curl 'localhost:9200/_mtermvectors' -d '{
docs/reference/docs/multi-termvectors.asciidoc:42:curl 'localhost:9200/testidx/_mtermvectors' -d '{
docs/reference/docs/multi-termvectors.asciidoc:64:curl 'localhost:9200/testidx/test/_mtermvectors' -d '{
docs/reference/docs/multi-termvectors.asciidoc:84:curl 'localhost:9200/testidx/test/_mtermvectors' -d '{
docs/reference/docs/multi-termvectors.asciidoc:102:curl 'localhost:9200/_mtermvectors' -d '{
docs/reference/indices/update-settings.asciidoc:24:curl -XPUT 'localhost:9200/my_index/_settings' -d '
docs/reference/indices/update-settings.asciidoc:46:curl -XPUT localhost:9200/test/_settings -d '{
docs/reference/indices/update-settings.asciidoc:60:curl -XPUT localhost:9200/test/_settings -d '{
docs/reference/indices/update-settings.asciidoc:88:curl -XPUT 'localhost:9200/myindex/_settings' -d '{
docs/reference/indices/shadow-replicas.asciidoc:47:curl -XPUT 'localhost:9200/my_index' -d '
docs/reference/indices/analyze.asciidoc:12:curl -XGET 'localhost:9200/_analyze' -d '
docs/reference/indices/analyze.asciidoc:23:curl -XGET 'localhost:9200/_analyze' -d '
docs/reference/indices/analyze.asciidoc:36:curl -XGET 'localhost:9200/_analyze' -d '
docs/reference/indices/analyze.asciidoc:43:curl -XGET 'localhost:9200/_analyze' -d '
docs/reference/indices/analyze.asciidoc:58:curl -XGET 'localhost:9200/_analyze' -d '
docs/reference/indices/analyze.asciidoc:70:curl -XGET 'localhost:9200/test/_analyze' -d '
docs/reference/indices/analyze.asciidoc:82:curl -XGET 'localhost:9200/test/_analyze' -d '
docs/reference/indices/analyze.asciidoc:93:curl -XGET 'localhost:9200/test/_analyze' -d '
docs/reference/modules/scripting/native.asciidoc:61:curl -XPOST localhost:9200/_search -d '{
docs/reference/modules/snapshots.asciidoc:112:$ curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
docs/reference/modules/snapshots.asciidoc:126:$ curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
docs/reference/modules/transport.asciidoc:91:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/modules/transport.asciidoc:103:curl -XPUT localhost:9200/_cluster/settings -d '{
docs/reference/query-dsl/query-string-syntax.asciidoc:133:curly brackets `{min TO max}`.
docs/reference/query-dsl/terms-query.asciidoc:100:curl -XPUT localhost:9200/users/user/2 -d '{
docs/reference/search/request/rescore.asciidoc:44:curl -s -XPOST 'localhost:9200/_search' -d '{
docs/reference/search/request/rescore.asciidoc:91:curl -s -XPOST 'localhost:9200/_search' -d '{
docs/reference/search/multi-search.asciidoc:38:$ curl -XGET localhost:9200/_msearch --data-binary "@requests"; echo
docs/reference/search/multi-search.asciidoc:64:$ curl -XGET localhost:9200/test/_msearch --data-binary @requests; echo
docs/reference/search/multi-search.asciidoc:99:$ curl -XGET localhost:9200/_msearch/template --data-binary @requests; echo
docs/reference/search/multi-search.asciidoc:112:$ curl -XGET localhost:9200/_msearch/template --data-binary @requests; echo
docs/reference/search/search-template.asciidoc:560:$ curl -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
docs/reference/search/field-stats.asciidoc:41:curl -XPOST "http://localhost:9200/_field_stats?level=indices" -d '{
docs/reference/search/field-stats.asciidoc:310:curl -XPOST "http://localhost:9200/_field_stats?level=indices" -d '{
docs/reference/search/field-stats.asciidoc:344:curl -XPOST "http://localhost:9200/_field_stats?level=indices" -d '{
docs/reference/getting-started.asciidoc:590:curl -XPOST 'localhost:9200/bank/account/_bulk?pretty&refresh' --data-binary "@accounts.json"
(The above may not have caught all cases of curl needing a content-type)
I hope we can replace most of them with // CONSOLE instead (#18160).
@nik9000 I agree that should be the long-term result, but since #22691 is targeted at 5.3, I encourage that we either make #18160 a blocker for 5.3 or update all necessary curl entries to include -H "Content-Type: application/json" now.
I'll mark this as a blocker for 5.3.0. If we have time to convert, great. If not, we'll certainly add the content type.
OK! So this actually gets done I've semi-randomly assigned the references @jordansissel found above to people:
If you are assigned you have a few choices, in order of my preference:
// CONSOLE if appropriate.curl command is right as is. Like, say it isn't talking to Elasticsearch.Either way, tick the box when you are done.
If you are working on this: remember that there is now a 5.3 branch. So you have to merge fixes to 5.3, 5.x, and master.
I took another look at 5.3 and 5.x and fixed a few remaining curl requests without Content-Types. Everything looks good now so I'm closing this issue. Thanks for opening it @jordansissel and thanks to @jimczi, @tbrooks8, @danielmitterdorfer, @tlrx, @imotov, @cbuescher, @spinscale, @dakrone, and @areek for converting all of the required docs to CONSOLE! We're done here. Thanks again!
thanks everybody for making this happen
Most helpful comment
I took another look at 5.3 and 5.x and fixed a few remaining
curlrequests without Content-Types. Everything looks good now so I'm closing this issue. Thanks for opening it @jordansissel and thanks to @jimczi, @tbrooks8, @danielmitterdorfer, @tlrx, @imotov, @cbuescher, @spinscale, @dakrone, and @areek for converting all of the required docs to CONSOLE! We're done here. Thanks again!