ropensci / elastic

R client for the Elasticsearch HTTP API
https://docs.ropensci.org/elastic
Other
245 stars 58 forks source link

index is ignored in es_get #7

Closed gaborcsardi closed 10 years ago

gaborcsardi commented 10 years ago
library(elastic)
# Warning message:
# replacing previous import by ‘rjson::toJSON’ when loading ‘elastic’ 
con <- es_connect("http://search.r-pkg.org", 9200)
es_get(index="cran-devel", type="package", id="igraph")
# Error in es_get(index = "cran-devel", type = "package", id = "igraph") : 
#   client error: (403) Forbidden

The url should be base/index/type/id, AFAIK: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-get.html

library(httr)
GET("http://search.r-pkg.org:9200/cran-devel/package/igraph")
# Response [http://search.r-pkg.org:9200/cran-devel/package/igraph]
#   Status: 200
#   Content-type: application/json; charset=UTF-8
# {"_index":"cran-devel","_type":"package","_id":"igraph","_version":1,"found":true,
# "_source" : { "Package" : "igraph", "Version" : "0.7.1", 
# ...
sckott commented 10 years ago

hi @gaborcsardi - Sorry about that. Okay, this should work now, reinstall again from master.

es_connect("http://search.r-pkg.org", 9200)
es_get(index="cran-devel", type="package", id="igraph")
$`_index`
[1] "cran-devel"

$`_type`
[1] "package"

$`_id`
[1] "igraph"

$`_version`
[1] 1

$found
[1] TRUE

$`_source`
$`_source`$Package
[1] "igraph"

$`_source`$Version
[1] "0.7.1"

$`_source`$Date
[1] "2014-04-22"

$`_source`$Title
[1] "Network analysis and visualization"

$`_source`$Author
[1] "See AUTHORS file."

$`_source`$Maintainer
[1] "Gabor Csardi <csardi.gabor@gmail.com>"

$`_source`$Description
[1] "Routines for simple graphs and network analysis. igraph can handle large graphs very well and provides functions for generating random and regular graphs, graph visualization, centrality indices and much more."

$`_source`$Depends
[1] "methods"

$`_source`$Imports
[1] "Matrix"

$`_source`$Suggests
[1] "igraphdata, stats4, rgl, tcltk, graph, ape"

$`_source`$License
[1] "GPL (>= 2)"

$`_source`$URL
[1] "http://igraph.org"

$`_source`$SystemRequirements
[1] "gmp, libxml2"

$`_source`$BugReports
[1] "https://github.com/igraph/igraph/issues"

$`_source`$Packaged
[1] "2014-04-22 18:00:26 UTC; gaborcsardi"

$`_source`$NeedsCompilation
[1] "yes"

$`_source`$Repository
[1] "CRAN"

$`_source`$`Date/Publication`
[1] "2014-04-22 23:08:29"

$`_source`$date
[1] "2014-04-22T23:08:29-04:00"

$`_source`$revdeps
[1] 134