Explain a search query.
explain(
conn,
index,
id,
type = NULL,
source2 = NULL,
fields = NULL,
routing = NULL,
parent = NULL,
preference = NULL,
source = NULL,
q = NULL,
df = NULL,
analyzer = NULL,
analyze_wildcard = NULL,
lowercase_expanded_terms = NULL,
lenient = NULL,
default_operator = NULL,
source_exclude = NULL,
source_include = NULL,
body = NULL,
raw = FALSE,
...
)
an Elasticsearch connection object, see connect()
Only one index. Required
Document id, only one. Required
Only one document type, optional
(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 the leading underscore.
Allows to control which stored fields to return as part of the document explained.
Controls the routing in the case the routing was used during indexing.
Same effect as setting the routing parameter.
Controls on which shard the explain is executed.
Allows the data of the request to be put in the query string of the url.
The query string (maps to the query_string query).
The default field to use when no field prefix is defined within the query. Defaults to _all field.
The analyzer name to be used when analyzing the query string. Defaults to the analyzer of the _all field.
(logical) Should wildcard and prefix queries be
analyzed or not. Default: FALSE
Should terms be automatically lowercased
or not. Default: TRUE
If set to true will cause format based failures (like
providing text to a numeric field) to be ignored. Default: FALSE
The default operator to be used, can be AND or OR. Defaults to OR.
A vector of fields to exclude from the returned source2 field
A vector of fields to extract and return from the source2 field
The query definition using the Query DSL. This is passed in the body of the request.
If TRUE
(default), data is parsed to list. If FALSE
, then
raw JSON.
Curl args passed on to crul::HttpClient
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html
# NOT RUN {
(x <- connect())
explain(x, index = "plos", id = 14, q = "title:Germ")
body <- '{
"query": {
"match": { "title": "Germ" }
}
}'
explain(x, index = "plos", id = 14, body=body)
# }
Run the code above in your browser using DataLab