New template creation for shard value setup on elasticsearch

HI,
I'm trying to create own template to set shard value for my index, when i run shell script which contain template creation command i'm getting below error any one could help me on this,

{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

template.sh

curl -XPUT localhost:9200/_template/template_flyingarrow -d "
{
  "template": "*",
  "settings": {
    "number_of_shards": 2
  },
  "mappings": {
    "_doc": {
      "_source": {
        "enabled": false
      },
    }
  }
}"

Hi,

I remember I had a problem with the lastest versions and Curl, adding this header solved the problem :

-H 'Content-Type: application/json' 

bye,
Xavier

Issue resolved thank you so much

curl -H 'Content-Type: application/json' -XPUT 'localhost:9200/_template/template_flyingarrow' -d "
{
  \"index_patterns\": \"*\",
  \"settings\": {
   \"number_of_shards\": 2
  }
}"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.