How to import data from Elasticsearch

Install elastic R package

There is an R package called elastic that we can use to get data from Elasticsearch.

Click down arrow icon next to project name, then select Manage R Packages menu.

Select install New Packages tab and type elastic in the input field then click Install.

Create a R Script Data Source

Click plus (+) button next to the Data Frames and select R Script menu.

Type in R script like below by replacing path, user, pwd, port with the proper values.

library('elastic')
conn <- connect(host = "example.sample.com", 
        es_path = "", 
        es_user="elastic", 
        es_pwd = "some_password", 
        es_port = 9243, 
        es_transport_schema  = "https")
# Search data        
Search(conn, index = "plos", size = 1)$hits$hits

Click Run then save if the result looks ok.