Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

count

Get counts of the number of records per index.


Description

Get counts of the number of records per index.

Usage

count(conn, index = NULL, type = NULL, callopts = list(), verbose = TRUE, ...)

Arguments

conn

an Elasticsearch connection object, see connect()

index

Index, defaults to all indices

type

Document type, optional

callopts

Curl args passed on to crul::verb-GET

verbose

If TRUE (default) the url call used printed to console.

...

Further args passed on to elastic search HTTP API as parameters.

Details

You can also get a count of documents using Search() or Search_uri() and setting size = 0

Examples

## Not run: 
# connection setup
(x <- connect())

if (!index_exists(x, "plos")) {
  plosdat <- system.file("examples", "plos_data.json",
    package = "elastic")
  plosdat <- type_remover(plosdat)
  invisible(docs_bulk(x, plosdat))
}
if (!index_exists(x, "shakespeare")) {
  shake <- system.file("examples", "shakespeare_data_.json", 
    package = "elastic")
  invisible(docs_bulk(x, shake))
}

count(x)
count(x, index='plos')
count(x, index='shakespeare')
count(x, index=c('plos','shakespeare'), q="a*")
count(x, index=c('plos','shakespeare'), q="z*")

# Curl options
count(x, callopts = list(verbose = TRUE))

## End(Not run)

elastic

General Purpose Interface to 'Elasticsearch'

v1.2.0
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.