Getting error while creating template in kibana 5.3

Hello team,
I am using below query in kibana 5.3 to create template but getting below error:

{
  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: template is missing;"
      }
    ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: template is missing;"
  },
  "status": 400
}

template:

PUT _template/regulatoryagency
{
  "regulatoryagency": {
    "order": 0,
    "template": "prod:regulatoryagency*",
    "settings": {
      "index": {
       "refresh_interval": "60s",
	   
	   
        "analysis": {
          "filter": {
            "eGram_filter": {
              "token_chars": [
                "letter",
                "digit",
                "punctuation",
                "symbol"
              ],
              "min_gram": "2",
              "type": "edge_ngram",
              "max_gram": "20"
            }
          },
          "analyzer": {
            "eGram_analyzer": {
              "filter": [
                "lowercase",
                "asciifolding",
                "eGram_filter"
              ],
              "type": "custom",
              "tokenizer": "whitespace"
            }
          }
        }
      }
      }
    },
      "mappings": {
      "radoc": {
        "properties": {
          "agency": {
            "type": "text"
          },
          "customs_area_code": {
            "type": "text"
          },
          "dangerous_goods_commodity_ids": {
            "type": "text"
          },
          "effective_date": {
            "type": "date"
          },
          "exception_process_qualifiers": {
            "type": "text"
          },
          "expiration_date": {
            "type": "date"
          },
          "hsnumber": {
            "type": "text",
            "fields": {
              "exact": {
                "type": "text"
              }
            },
            "analyzer": "eGram_analyzer"
          },
          "intended_use_codes": {
            "type": "text"
          },
          "map_id": {
            "type": "text"
          },
          "produc_categories": {
            "type": "text"
          },
          "program": {
            "type": "text"
          },
          "restriction_id": {
            "type": "text"
          },
          "version": {
            "type": "text"
          }
        }
      },
      "doc": {
        "properties": {
          "agency": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "customs_area_code": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "effective_date": {
            "type": "date"
          },
          "expiration_date": {
            "type": "date"
          },
          "hsnumber": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            },
            "analyzer": "eGram_analyzer"
          },
          "intended_use_codes": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "map_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "product_categories": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "program": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "restriction_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "version": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
        }
    },
    "aliases": {}
  }

Hi

Have you tried it like this?

So removing the root JSON property regulatoryagency

PUT _template/regulatoryagency
{
    "order": 0,

Thank you so much @matw for quick reponse. Its worked for me

1 Like

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