Learn R Programming

elastic (version 0.7.8)

validate: Validate a search

Description

Validate a search

Usage

validate(index, type = NULL, ...)

Arguments

index

Index name. Required.

type

Document type. Optional.

...

Additional args passed on to Search

See Also

Search

Examples

Run this code
# NOT RUN {
if (!index_exists("twitter")) index_create("twitter")
docs_create('twitter', type='tweet', id=1, body = list(
   "user" = "foobar", 
   "post_date" = "2014-01-03",
   "message" = "trying out Elasticsearch"
 )
)
validate("twitter", q='user:foobar')
validate("twitter", "tweet", q='user:foobar')

body <- '{
"query" : {
  "bool" : {
    "must" : {
      "query_string" : {
        "query" : "*:*"
      }
    },
    "filter" : {
      "term" : { "user" : "kimchy" }
    }
  }
}
}'
validate("twitter", body = body)
# }

Run the code above in your browser using DataLab