Class: Elasticsearch::Autocomplete::SingleRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/elasticsearch/autocomplete/single_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#index, #query, #types

Instance Method Summary collapse

Constructor Details

#initialize(index, query, types, field) ⇒ SingleRequest

Returns a new instance of SingleRequest.



19
20
21
22
# File 'lib/elasticsearch/autocomplete/single_request.rb', line 19

def initialize(index, query, types, field)
  super(index, query, types)
  self.field = field
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



17
18
19
# File 'lib/elasticsearch/autocomplete/single_request.rb', line 17

def field
  @field
end

Instance Method Details

#bodyObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/elasticsearch/autocomplete/single_request.rb', line 24

def body
  @body ||= begin
    {
      :index => index,
      :type => types.map(&:type).uniq,
      :body => {
        :query => Type.single_search(query, field)
      }
    }
  end
end