connect: Set connection details to an Elasticsearch engine.

Description Usage Arguments Details See Also Examples

View source: R/connect.R

Description

Set connection details to an Elasticsearch engine.

Usage

1
2
3
4
5
6
connect(es_host = "127.0.0.1", es_port = 9200, es_path = NULL,
  es_transport_schema = "http", es_user = NULL, es_pwd = NULL,
  force = FALSE, errors = "simple", es_base = NULL, headers = NULL,
  ...)

connection()

Arguments

es_host

(character) The base host, defaults to 127.0.0.1 Synonym of es_base

es_port

(character) port to connect to, defaults to 9200 (optional)

es_path

(character) context path that is appended to the end of the url. Default: NULL, ignored

es_transport_schema

(character) http or https. Default: http

es_user

(character) User name, if required for the connection. You can specify, but ignored for now.

es_pwd

(character) Password, if required for the connection. You can specify, but ignored for now.

force

(logical) Force re-load of connection details

errors

(character) One of simple (Default) or complete. Simple gives http code and error message on an error, while complete gives both http code and error message, and stack trace, if available.

es_base

(character) Synonym of es_host, and will be gone in a future version of elastic

headers

Either an object of class request or a list that can be coerced to an object of class request via httr::add_headers(). These headers are used in all requests. To use headers in individual requests and not others, pass in headers using httr::add_headers() via ... in a function call.

...

Further args passed on to print for the es_conn class.

Details

The default configuration is set up for localhost access on port 9200, with no username or password.

connect() and connection() no longer ping the Elasticsearch server, but only print your connection details.

Internally, we store your connection settings with environment variables. That means you can set your env vars permanently in .Renviron file, and use them on a server e.g., as private env vars

See Also

ping() to check your connection

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
## Not run: 
# the default is set to 127.0.0.1 (i.e., localhost) and port 9200
connect()

# set a different host
# connect(es_host = '162.243.152.53')
# => http://162.243.152.53:9200

# set a different port
# connect(es_port = 8000)
# => http://localhost:8000

# set a different context path
# connect(es_path = 'foo_bar')
# => http://localhost:9200/foo_bar

# set to https
# connect(es_transport_schema = 'https')
# => https://localhost:9200

# See connection details
connection()

# set headers
connect(headers = list(a = 5))
## or
connect(headers = add_headers(a = 5))

## End(Not run)

ropensci/elastic documentation built on Aug. 11, 2018, 3:46 a.m.