Class: ROM::Elasticsearch::Gateway
- Inherits:
-
Gateway
- Object
- Gateway
- ROM::Elasticsearch::Gateway
- 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)
51 52 53 |
# File 'lib/rom/elasticsearch/gateway.rb', line 51 def client @client end |
#url ⇒ Object (readonly)
47 48 49 |
# File 'lib/rom/elasticsearch/gateway.rb', line 47 def url @url end |
Instance Method Details
#dataset(index) ⇒ Dataset Also known as: []
Get a dataset by its :index name
78 79 80 81 |
# File 'lib/rom/elasticsearch/gateway.rb', line 78 def dataset(index) idx_name = IndexName[index] Dataset.new(client, params: { index: idx_name.to_sym, type: idx_name.type }) end |
#dataset?(index) ⇒ Boolean Also known as: index?
Return true if a dataset with the given :index exists
66 67 68 |
# File 'lib/rom/elasticsearch/gateway.rb', line 66 def dataset?(index) client.indices.exists?(index: index) end |