index_template: Index templates

Description Usage Arguments References Examples

Description

Index templates allow you to define templates that will automatically be applied when new indices are created

Usage

1
2
3
4
5
6
7
8
index_template_put(name, body = NULL, create = NULL, flat_settings = NULL,
  master_timeout = NULL, order = NULL, timeout = NULL, ...)

index_template_get(name = NULL, filter_path = NULL, ...)

index_template_exists(name, ...)

index_template_delete(name, ...)

Arguments

name

(character) The name of the template

body

(character/list) The template definition

create

(logical) Whether the index template should only be added if new or can also replace an existing one. Default: FALSE

flat_settings

(logical) Return settings in flat format. Default: FALSE

master_timeout

(integer) Specify timeout for connection to master

order

(integer) The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)

timeout

(integer) Explicit operation timeout

...

Curl options. Or in percolate_list function, further args passed on to Search()

filter_path

(character) a regex for filtering output path, see example

References

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Not run: 
body <- '{
  "template": "te*",
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "type1": {
      "_source": {
        "enabled": false
      },
      "properties": {
        "host_name": {
          "type": "keyword"
        },
        "created_at": {
          "type": "date",
          "format": "EEE MMM dd HH:mm:ss Z YYYY"
        }
      }
    }
  }
}'
index_template_put("template_1", body = body)

# get templates
index_template_get()
index_template_get("template_1")
index_template_get(c("template_1", "template_2"))
index_template_get("template_*")
## filter path
index_template_get("template_1", filter_path = "*.template")

# template exists
index_template_exists("template_1")
index_template_exists("foobar")

# delete a template
index_template_delete("template_1")
index_template_exists("template_1")

## End(Not run)

ropensci/elastic documentation built on Feb. 15, 2018, 6:10 p.m.