class ES::Index::SearchResponse

{

     "took" => 0,
"timed_out" => false,
  "_shards" => {
           "total" => 5,
      "successful" => 5,
          "failed" => 0
  },
     "hits" => {
            "total" => 2468,
        "max_score" => 1.0,
             "hits" => [
            [0] {
                 "_index" => "services",
                  "_type" => "service",
                    "_id" => "b86ac976-5c5b-11e3-9470-cc5bbc629773",
                 "_score" => 1.0,
                "_source" => {
                            "name" => "...",
                            "guid" => "b86ac976-5c5b-11e3-9470-cc5bbc629773",
                     "description" => nil,
                    "account_guid" => "77c57a7f-6ff3-4918-8f61-ef5ae5a04e18",
                       "user_guid" => "3cc66723-f788-40d7-8583-bfa09cec5623",
                          "domain" => nil,
                       "is_public" => false
                }
            }
        ]
    }
}

Attributes

model[RW]
raw_response[RW]

Public Class Methods

new(response, model) click to toggle source
# File lib/es/index/search_response.rb, line 40
def initialize(response, model)
  @raw_response = HashResponse.new(response)
  @model = model
  self
end

Public Instance Methods

hits() click to toggle source
# File lib/es/index/search_response.rb, line 46
def hits
  HashResponse.new(@raw_response.hits)
end
max_score() click to toggle source
# File lib/es/index/search_response.rb, line 54
def max_score
  hits.max_score
end
method_missing(method, *args, &block) click to toggle source
# File lib/es/index/search_response.rb, line 78
def method_missing(method, *args, &block)
  @raw_response.send(method, *args, &block)
end
models() click to toggle source
# File lib/es/index/search_response.rb, line 62
def models
  @model.es_results_to_models.call(results)
end
results() click to toggle source
# File lib/es/index/search_response.rb, line 58
def results
  hits.hits
end
shards() click to toggle source
# File lib/es/index/search_response.rb, line 74
def shards
  @raw_response._shards
end
timed_out() click to toggle source
# File lib/es/index/search_response.rb, line 70
def timed_out
  @raw_response.timed_out
end
took() click to toggle source
# File lib/es/index/search_response.rb, line 66
def took
  @raw_response.took
end
total() click to toggle source
# File lib/es/index/search_response.rb, line 50
def total
  hits.total
end