Hi Experts,
I met an issue during modify a parameter from template.
I want to modify a value of parameter which named "total_fields" in template such like this:
I use curl to input several commands to modify it, but all of them are returned failed and the log shows as below:
[admin@HPG5L3 ~]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09 .05 -d ' { "settings" : { "index.mapping.total_fields.limit" : "2000" } }'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not support [admin@HPG5L3 ~]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -d ' { "settings" : { "index.mapping.total_fields.limit" : "2000" } }'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -d ' { "default" : { "total_fields.limit" : "3000" } }'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -d ' { "settings" : { "total_fields.limit" : "3000" } }'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$
[admin@HPG5L3 ~]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -d '
> {
> "order" : 1,
> "index_patterns": ["lsh_nokia_nokiasbc-2019.09*"],
> "settings" : {
> "index.mapping.total_fields.limit": 3000,
> }
> }'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
[admin@HPG5L3 ~]$
All of the failed returns are showed as this:
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
I have retrieved the similar issue and find that in elasticsearch 6.0 or high version there is a "Strict Content-Type Checking for Elasticsearch REST Requests"
You can refer to this URL to find the detailed report:
In this report, we can see we need do this action to adapt our pattern script
I have followed its indication then add the Content-type by curl command, but it still failed:
[admin@HPG5L3 SBClog]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -H 'Content-Type: application/json'
{"error":{"root_cause":[{"type":"parse_exception","reason":"request body is required"}],"type":"parse_exception","reason":"request body is required"},"status":400}
[admin@HPG5L3 SBClog]$
[admin@HPG5L3 bin]$ curl -XPUT localhost:9200/_template/lsh_nokia_nokiasbc-2019.09.05 -H 'Content-Type: application/json' -d ' { "settings" : { "index.mapping.total_fields.limit" : "2000" } }'
{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: index patterns are missing;"}],"type":"action_request_validation_exception","reason":"Validati [admin@HPG5L3 bin]$
[admin@HPG5L3 bin]$
[admin@HPG5L3 bin]$
[admin@HPG5L3 bin]$
[admin@HPG5L3 bin]$
[admin@HPG5L3 bin]$ curl -XGET http://localhost:9200/_cat/indices/?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open template d4QOtkyhSLyGi9Y3afAh7Q 1 1 0 0 283b 283b
green open .kibana_task_manager 0_fwrwI_TBqCB4gY3-3iPg 1 0 2 4 98.7kb 98.7kb
yellow open lsh_nokia_nokiasbc-2019.09.05 ilVqiOj8S3Sp2a1YIyzYPA 1 1 54 0 330.6kb 330.6kb
green open .kibana_1 3Yjilne2QVO_z83G1UZHkw 1 0 10 3 187.2kb 187.2kb
Now my major question is how can I do to add a header " -H 'Content-Type: application/json' " successfully?
Thank you.