Name: elasticdsl
Owner: rOpenSci
Description: Elasticsearch R DSL
Created: 2015-02-22 18:49:54.0
Updated: 2017-10-26 23:48:19.0
Pushed: 2017-02-14 05:41:24.0
Size: 76
Language: R
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
An R DSL for Elasticsearch
v1.4
of Elasticsearch.You're fine running ES locally on your machine, but be careful just throwing up ES on a server with a public IP address - make sure to think about security.
all.packages("devtools")
ools::install_github("ropensci/elasticdsl")
ary('elasticdsl')
Instructions for installing, upgrading, starting Elasticsearch, and loading example data at ropensci/elastic
The function elastic::connect()
is used before doing anything else to set the connection details to your remote or local elasticdslsearch store. The details created by connect()
are written to your options for the current session, and are used by elasticdsl
functions.
tic::connect(es_port = 9200)
rl: http://127.0.0.1
ort: 9200
sername: NULL
assword: NULL
lasticsearch details:
status: 200
name: Gloom
Elasticsearch version: 1.7.2
ES version timestamp: 2015-09-14T09:49:53Z
lucene version: 4.10.4
x("shakespeare")
index> shakespeare
type:
mappings:
line:
line_id: long
line_number: string
play_name: string
speaker: string
speech_number: long
text_entry: string
x("shakespeare") %>%
lter() %>%
s(c(1, 2, 150)) %>%
plain() # doesn't exist yet
<- index("shakespeare") %>%
lter() %>%
s(c(1, 2)) %>%
ec()
x("shakespeare") %>%
s(c(1, 2)) %>%
ec() %>%
)
1] 2
x("shakespeare") %>%
lter() %>%
efix(speaker = "we") %>%
ze(2) %>%
elds(play_name) %>%
ec() %>%
)
1] 44
index("shakespeare") %>%
lter() %>%
efix(speaker = "we") %>%
ze(2)
% fields(play_name) %>% exec() %>% .$hits %>% .$hits
[1]]
[1]]$`_index`
1] "shakespeare"
[1]]$`_type`
1] "line"
[1]]$`_id`
1] "42"
% fields(play_name, text_entry) %>% exec() %>% .$hits %>% .$hits
[1]]
[1]]$`_index`
1] "shakespeare"
[1]]$`_type`
1] "line"
[1]]$`_id`
1] "42"
% fields(play_name, text_entry, line_id) %>% exec() %>% .$hits %>% .$hits
[1]]
[1]]$`_index`
1] "shakespeare"
[1]]$`_type`
1] "line"
[1]]$`_id`
1] "42"
Filters are boolean queries and are much more computationally efficient than queries.
prefix
filter
x("shakespeare") %>%
lter() %>%
efix(speaker = "we") %>%
ec() %>%
)
1] 44
ids
filter
x("shakespeare") %>%
lter() %>%
s(c(1, 2, 150)) %>%
ec() %>%
)
1] 3
geoshape
query (filters have a much larger range of geo queries)
x("geoshape") %>%
oshape(field = "location", type = "envelope", coordinates = list(c(-30, 50), c(30, 0))) %>%
)
1] 10
elasticdsl
in R doing citation(package = 'elasticdsl')