1// indices/templates.asciidoc:10
2
3[source, php]
4----
5$params = [
6    'name' => 'template_1',
7    'body' => [
8        'index_patterns' => [
9            'te*',
10            'bar*',
11        ],
12        'settings' => [
13            'number_of_shards' => 1,
14        ],
15        'mappings' => [
16            '_source' => [
17                'enabled' => false,
18            ],
19            'properties' => [
20                'host_name' => [
21                    'type' => 'keyword',
22                ],
23                'created_at' => [
24                    'type' => 'date',
25                    'format' => 'EEE MMM dd HH:mm:ss Z yyyy',
26                ],
27            ],
28        ],
29    ],
30];
31$response = $client->indices()->putTemplate($params);
32----
33