module Ohm::Elasticsearch::ClassMethods
Public Instance Methods
index_name()
click to toggle source
# File lib/ohm/elasticsearch.rb, line 28 def index_name "#{name}_main".downcase end
index_type()
click to toggle source
# File lib/ohm/elasticsearch.rb, line 32 def index_type name.downcase end
indexer()
click to toggle source
# File lib/ohm/elasticsearch.rb, line 24 def indexer Ohm::Elasticsearch.current_indexer end
search(args={})
click to toggle source
args: {body: { query: { match: { title: ‘test’ } } } }
# File lib/ohm/elasticsearch.rb, line 38 def search(args={}) params = {index: index_name}.merge(args) indexer.search params end
search_template(args={})
click to toggle source
args:
{body: { template: { query: { range: { date: { gte: "{{start}}", lte: "{{end}}" } } } }, params: { start: "2014-02-01", end: "2014-03-01" } } }
# File lib/ohm/elasticsearch.rb, line 55 def search_template(args={}) template = {index: index_name} template.merge!(body: args) indexer.search_template template end