explain: Explain a search query.

Description Usage Arguments References Examples

View source: R/explain.R

Description

Explain a search query.

Usage

1
2
3
4
5
6
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 = NULL, lowercase_expanded_terms = NULL,
  lenient = NULL, 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 the leading underscore.

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 httr::GET()

References

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
explain(index = "plos", type = "article", id = 14, q = "title:Germ")

body <- '{
 "query": {
   "term": { "title": "Germ" }
 }
}'
explain(index = "plos", type = "article", id = 14, body=body)

## End(Not run)

ropensci/elastic documentation built on Dec. 17, 2018, 11:08 a.m.