Class: Skala::ElasticsearchAdapter::Search
- Inherits:
-
Adapter::Search
- Object
- Adapter::Operation
- Adapter::Search
- Skala::ElasticsearchAdapter::Search
- Defined in:
- lib/skala/elasticsearch_adapter/search.rb
Defined Under Namespace
Classes: RequestTransformation, ResultTransformation
Instance Attribute Summary
Attributes inherited from Adapter::Operation
Instance Method Summary collapse
Methods inherited from Adapter::Operation
Constructor Details
This class inherits a constructor from Skala::Adapter::Operation
Instance Method Details
#call(search_request, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/skala/elasticsearch_adapter/search.rb', line 8 def call(search_request, = {}) 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 |