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:



22
23
24
# File 'lib/rom/elasticsearch/query_methods.rb', line 22

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:



61
62
63
# File 'lib/rom/elasticsearch/query_methods.rb', line 61

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:



48
49
50
# File 'lib/rom/elasticsearch/query_methods.rb', line 48

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:



35
36
37
# File 'lib/rom/elasticsearch/query_methods.rb', line 35

def search(options)
  body(options)
end