# NOT RUN {
x <- connect()
if (gsub("\\.", "", x$ping()$version$number) < 500) {
field_stats(x, body = '{ "fields": ["speaker"] }', index = "shakespeare")
ff <- c("scientificName", "continent", "decimalLatitude", "play_name",
"speech_number")
field_stats(x, "play_name")
field_stats(x, "play_name", level = "cluster")
field_stats(x, ff, level = "indices")
field_stats(x, ff)
field_stats(x, ff, index = c("gbif", "shakespeare"))
# can also pass a body, just as with Search()
# field_stats(x, body = list(fields = "rating")) # doesn't work
field_stats(x, body = '{ "fields": ["scientificName"] }', index = "gbif")
body <- '{
"fields" : ["scientificName", "decimalLatitude"]
}'
field_stats(x, body = body, level = "indices", index = "gbif")
}
# }
Run the code above in your browser using DataLab