Module: ROM::Elasticsearch::QueryMethods

Included in:
Dataset
Defined in:
lib/rom/elasticsearch/query_methods.rb

Overview

Dataset's query methods

See Also:

Instance Method Summary collapse

Instance Method Details

#get(id) ⇒ Dataset

Return a new dataset configured to search by :id

Parameters:

  • id (Integer)

Returns:

See Also:



20
21
22
# File 'lib/rom/elasticsearch/query_methods.rb', line 20

def get(id)
  params(id: id)
end

#query(query) ⇒ Dataset

Return a new dataset configured to search via :query body option

Parameters:

  • query (Hash)

    A query hash

Returns:

See Also:



59
60
61
# File 'lib/rom/elasticsearch/query_methods.rb', line 59

def query(query)
  body(query: query)
end

#query_string(expression) ⇒ Dataset

Return a new dataset configured to search via :query_string body option

Parameters:

  • expression (String)

    A string query

Returns:

See Also:



46
47
48
# File 'lib/rom/elasticsearch/query_methods.rb', line 46

def query_string(expression)
  query(query_string: { query: expression })
end

#search(options) ⇒ Dataset

Return a new dataset configured to search via new body options

Parameters:

  • options (Hash)

    Body options

Returns:

See Also:



33
34
35
# File 'lib/rom/elasticsearch/query_methods.rb', line 33

def search(options)
  body(options)
end