Sha256: 786762e9ebd0c8d19e7d8c3c5f18c90d17f5b404e9ac66c34f506ba6297c7289

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

require "skala/adapter/search"
require_relative "../elasticsearch_adapter"

class Skala::ElasticsearchAdapter::Search < Skala::Adapter::Search
  require_relative "./search/request_transformation"
  require_relative "./search/result_transformation"

  def call(search_request, options = {})
    elasticsearch_request = {
      body: RequestTransformation.new.call(search_request),
      index: @adapter.index
    }

    elasticsearch_result = @adapter.elasticsearch_client.search(elasticsearch_request)

    ResultTransformation.new.call(elasticsearch_result, search_request: search_request)
  rescue Elasticsearch::Transport::Transport::Errors::BadRequest
    raise Skala::Adapter::BadRequestError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skala-1.1.0 lib/skala/elasticsearch_adapter/search.rb