Learn R Programming

elasticsearchr (version 0.3.1)

valid_connection: Validate healthy Elasticsearch connection.

Description

Validates healthy Elasticsearch connections by attempting to call the cluster healthcheck endpoint. In doing to, it defends against incorrect URLs to Elasticsearch clusters. Requires that URLs point directly to a master node - i.e. the endpoint that would return the default Elasticsearch message, "You Know, for Search", e.g. `http://localhost:9200`.

Usage

valid_connection(url)

Arguments

url

The URL to validate.

Value

Boolean

Examples

Run this code
# NOT RUN {
url <- "http://localhost:9200"
valid_connection(url)
# TRUE

url <- "http://localhost:9201"
valid_connection(url)
#  Error: Failed to connect to localhost port 9201: Connection refused
# }

Run the code above in your browser using DataLab