Module: Eson::HTTP::MultiSearch
Instance Method Summary collapse
Methods included from API
Instance Method Details
#path ⇒ Object
9 10 11 |
# File 'lib/eson/http/core/msearch.rb', line 9 def path '/_msearch' end |
#serialize_request(request) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/eson/http/core/msearch.rb', line 17 def serialize_request(request) case request when Eson::HTTP::Search MultiJson.encode(to_params_hash(request)) << "\n" << request.source << "\n" else warn("Unserializable request #{request.inspect}") end end |
#source ⇒ Object
13 14 15 |
# File 'lib/eson/http/core/msearch.rb', line 13 def source msearch.map {|r| serialize_request(r)}.join end |
#to_params_hash(r) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/eson/http/core/msearch.rb', line 26 def to_params_hash(r) r.url_params.inject({}) do |h, p| val = r.send(p) if val h[p] = val unless val.respond_to?(:empty?) && val.empty? end h end end |