Method: Elasticsearch::API::Actions#explain
- Defined in:
- lib/elasticsearch/api/actions/explain.rb
#explain(arguments = {}) ⇒ Object
Return information if and how well a document matches a query.
The returned information contains a ‘_score` and its explanation, if the document matches the query.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/elasticsearch/api/actions/explain.rb', line 46 def explain(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] valid_params = [ :analyze_wildcard, :analyzer, :default_operator, :df, :fields, :lenient, :lowercase_expanded_terms, :parent, :preference, :q, :routing, :source, :_source, :_source_include, :_source_exclude, :stored_fields ] method = HTTP_GET path = Utils.__pathify Utils.__escape(arguments[:index]), Utils.__escape(arguments[:type]), Utils.__escape(arguments[:id]), '_explain' params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] params[:fields] = Utils.__listify(params[:fields]) if params[:fields] perform_request(method, path, params, body).body end |