Difference between "index_patterns" and "template"

Hi ((:

What is the difference between those keywords when creating a mapping? For instance:

curl -XPUT 'localhost:9200/_template/template1?pretty' -H "Content-Type: application/json" -d '{
  "index_patterns": ["abc*"],
   "template": "abc*",
    "mappings": { "properties": { "age": { "type": "long" } } }
}'

Or can anyone point me to some documentation or good reference?

Thx (:

1 Like

index_patterns can be an array where as template could only be a single string with a simple regular expression. The original PR is here: https://github.com/elastic/elasticsearch/pull/21009

Hope this helps!

Thank you for your replay (: ... so basically index_patternsand templates provides the same functionality except that index_patterns can hold an array of indices where the template will be assigned?

indeed. and newer elasticsearch verions require to use index_patterns

2 Likes

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