Create a custom ECS settings via github repo

Hi,

I'm trying to generate ecs template with custom settings. For that, I used this repo GitHub - elastic/ecs: Elastic Common Schema.

Command used :
python scripts/generator.py --template-settings template.json --ref v1.7.0 --out ./test

Setting template used :

{
  "index_patterns": ["fluentd_openshift-sbx-*"],
  "order": 1,
  "settings": {
    "index": {
      "lifecycle": {
        "name": "openshift",
        "rollover_alias": "fluentd_openshift-sbx"
      },
      "number_of_shards": "1",
      "number_of_replicas": "1",
      "mapping": {
        "total_fields": {
          "limit": 1000
        }
      }
    }
  }
}

Problem is that this template generated cannot be sent to elasticsearch :

{
  "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[1:58] [index_template] unknown field [mappings]"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[1:58] [index_template] unknown field [mappings]"
  },
  "status" : 400
}

Why I can't push this generated template ? Did I missed something ?

Best regards,

Thomas

Hi, @Thomas74!

I've seen that error when submitting a legacy index template to the _index_template API instead of the _template legacy index template API.

Which API are you using when you see the error? And which generated ES artifact are you trying to install?

Hello @ebeahan

It seems that I was wrong when submitting my index template...

I think you are right, I used bad legacy index API. With_template API it works.

curl -X POST "https://elastic.lan:9200/_template/test-ecs" -u user:xxx -H 'Content-Type: application/json' -k -d @template.json

I didn't select specifics artifacts for now. I tried with a minimum specific config to know if I was in a good way of working :slight_smile:

Thanks for your answer !

1 Like

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