Learn R Programming

elastic (version 0.3.0)

explain: Explain a search query.

Description

Explain a search query.

Usage

explain(index = NULL, type = NULL, id = NULL, source2 = NULL,
  fields = NULL, routing = NULL, parent = NULL, preference = NULL,
  source = NULL, q = NULL, df = NULL, analyzer = NULL,
  analyze_wildcard = FALSE, lowercase_expanded_terms = TRUE,
  lenient = FALSE, default_operator = NULL, source_exclude = NULL,
  source_include = NULL, body = NULL, raw = FALSE, ...)

Arguments

index
Only one index
type
Only one document type
id
Document id, only one
source2
(logical) Set to TRUE to retrieve the _source of the document explained. You can also retrieve part of the document by using source_include & source_exclude (see Get API for more details). This matches the _source term, but we want to avoid t
fields
Allows to control which stored fields to return as part of the document explained.
routing
Controls the routing in the case the routing was used during indexing.
parent
Same effect as setting the routing parameter.
preference
Controls on which shard the explain is executed.
source
Allows the data of the request to be put in the query string of the url.
q
The query string (maps to the query_string query).
df
The default field to use when no field prefix is defined within the query. Defaults to _all field.
analyzer
The analyzer name to be used when analyzing the query string. Defaults to the analyzer of the _all field.
analyze_wildcard
(logical) Should wildcard and prefix queries be analyzed or not. Default: FALSE
lowercase_expanded_terms
Should terms be automatically lowercased or not. Default: TRUE
lenient
If set to true will cause format based failures (like providing text to a numeric field) to be ignored. Default: FALSE
default_operator
The default operator to be used, can be AND or OR. Defaults to OR.
source_exclude
A vector of fields to exclude from the returned source2 field
source_include
A vector of fields to extract and return from the source2 field
body
The query definition using the Query DSL. This is passed in the body of the request.
raw
If TRUE (default), data is parsed to list. If FALSE, then raw JSON.
...
Curl args passed on to GET

References

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-shards.html

Examples

Run this code
explain(index = "plos", type = "article", id = 10, q = "abstract:used")

body <- '{
 "query": {
   "term": { "abstract": "used" }
 }
}'
explain(index = "plos", type = "article", id = 10, body=body)

Run the code above in your browser using DataLab