alias: Elasticsearch alias APIs

Description Usage Arguments Details Author(s) References Examples

Description

Elasticsearch alias APIs

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
alias_get(index = NULL, alias = NULL, ignore_unavailable = FALSE,
  ...)

aliases_get(index = NULL, alias = NULL, ignore_unavailable = FALSE,
  ...)

alias_exists(index = NULL, alias = NULL, ...)

alias_create(index, alias, filter = NULL, routing = NULL,
  search_routing = NULL, index_routing = NULL, ...)

alias_rename(index, alias, alias_new, ...)

alias_delete(index = NULL, alias, ...)

Arguments

index

(character) An index name

alias

(character) An alias name

ignore_unavailable

(logical) What to do if an specified index name doesn't exist. If set to TRUE then those indices are ignored.

...

Curl args passed on to httr::POST(), httr::GET(), httr::HEAD(), or httr::DELETE()

filter

(named list) provides an easy way to create different "views" of the same index. Defined using Query DSL and is applied to all Search, Count, Delete By Query and More Like This operations with this alias. See examples

routing, search_routing, index_routing

(character) Associate a routing value with an alias

alias_new

(character) A new alias name, used in rename only

Details

Note that you can also create aliases when you create indices by putting the directive in the request body. See the Elasticsearch docs link

Author(s)

Scott Chamberlain [email protected]

References

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.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
43
44
45
46
## Not run: 
# Create/update an alias
alias_create(index = "plos", alias = "candles", config = httr::verbose())
## more than one alias
alias_create(index = "plos", alias = c("tables", "chairs"), config = httr::verbose())

# associate an alias with two multiple different indices
alias_create(index = c("plos", "shakespeare"), alias = "stools", config = httr::verbose())

# Retrieve a specified alias
alias_get(index="plos")
alias_get(alias="tables")
alias_get(alias="stools")
aliases_get()

# rename an alias
aliases_get("plos")
alias_rename(index = 'plos', alias = "stools", alias_new = "plates")
aliases_get("plos")

# filtered aliases
alias_create(index = "plos", alias = "candles", 
  filter = list(wildcard = list(title = "cell")))
## a search with the alias should give titles with cell in them
(titles <- Search("candles", asdf = TRUE)$hits$hits$`_source.title`)
grepl("cell", titles, ignore.case = TRUE)

# routing
alias_create(index = "plos", alias = "candles", 
  routing = "1")

# Check for alias existence
alias_exists(index = "plos")
alias_exists(alias = "tables")
alias_exists(alias = "adsfasdf")

# Delete an alias
alias_delete(index = "plos", alias = "candles")
alias_exists(alias = "tables")

# Curl options
library("httr")
alias_create(index = "plos", alias = "tables")
aliases_get(alias = "tables", config=verbose())

## End(Not run)

ropensci/elastic documentation built on Dec. 17, 2018, 11:08 a.m.