class AgnosticBackend::Queryable::Elasticsearch::Executor

Public Instance Methods

execute() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 7
def execute
  if scroll_cursor.present?
    response = client.send_request(:post, path: "_search/scroll", body: params)
  else 
    response = client.send_request(:post, path: "#{index.index_name}/#{index.type}/_search", body: params)
  end          
  ResultSet.new(ActiveSupport::JSON.decode(response.body), query)
end
params() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 20
def params
  scroll_cursor.present? ? scroll_cursor : query.accept(visitor)
end
to_s() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 16
def to_s
  params
end

Private Instance Methods

client() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 26
def client
  index.client
end
index() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 30
def index
  query.context.index
end
scroll_cursor() click to toggle source
# File lib/agnostic_backend/queryable/elasticsearch/executor.rb, line 34
def scroll_cursor
  scroll_cursor_expression.accept(visitor) if scroll_cursor_expression
end