Class: ROM::Elasticsearch::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::Elasticsearch::Gateway
- Extended by:
- Initializer
- Defined in:
- lib/rom/elasticsearch/gateway.rb
Overview
Elasticsearch gateway
Instance Attribute Summary collapse
- #client ⇒ Object readonly
- #url ⇒ Object readonly
Instance Method Summary collapse
-
#dataset(index) ⇒ Dataset
(also: #[])
Get a dataset by its :index name.
-
#dataset?(index) ⇒ Boolean
(also: #index?)
Return true if a dataset with the given :index exists.
Instance Attribute Details
#client ⇒ Object (readonly)
57 58 59 |
# File 'lib/rom/elasticsearch/gateway.rb', line 57 def client @client end |
#url ⇒ Object (readonly)
53 54 55 |
# File 'lib/rom/elasticsearch/gateway.rb', line 53 def url @url end |
Instance Method Details
#dataset(index) ⇒ Dataset Also known as: []
Get a dataset by its :index name
82 83 84 85 |
# File 'lib/rom/elasticsearch/gateway.rb', line 82 def dataset(index) idx_name = IndexName[index] Dataset.new(client, params: {index: idx_name.to_sym}) end |
#dataset?(index) ⇒ Boolean Also known as: index?
Return true if a dataset with the given :index exists
70 71 72 |
# File 'lib/rom/elasticsearch/gateway.rb', line 70 def dataset?(index) client.indices.exists?(index: index) end |