Class: JayAPI::Elasticsearch::Stats::Indices
- Inherits:
-
Object
- Object
- JayAPI::Elasticsearch::Stats::Indices
- Defined in:
- lib/jay_api/elasticsearch/stats/indices.rb
Overview
Provides access to the list of indices returned by Elasticsearch’s Stats API
Constant Summary collapse
- SYSTEM_SELECTOR =
A lambda used to select / reject system indices (indices whose name starts with dot).
->(name, _data) { name.starts_with?('.') }
Instance Method Summary collapse
-
#all ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
A lazy enumerator of
Index
objects, one for each of the indexes. -
#initialize(indices) ⇒ Indices
constructor
A new instance of Indices.
-
#system ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
A lazy enumerator of
Index
objects. -
#user ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
A lazy enumerator of
Index
objects.
Constructor Details
#initialize(indices) ⇒ Indices
Returns a new instance of Indices.
18 19 20 |
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 18 def initialize(indices) @indices = indices end |
Instance Method Details
#all ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
Returns A lazy enumerator of Index
objects, one for each of the indexes. All indices (system and user-defined are included).
25 26 27 |
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 25 def all @all ||= with_lazy_instantiation { indices } end |
#system ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
Returns A lazy enumerator of Index
objects. Includes only the system indices.
31 32 33 |
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 31 def system @system ||= with_lazy_instantiation { indices.select(&SYSTEM_SELECTOR) } end |
#user ⇒ Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>
Returns A lazy enumerator of Index
objects. Includes only the user-defined indices.
38 39 40 |
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 38 def user @user ||= with_lazy_instantiation { indices.reject(&SYSTEM_SELECTOR) } end |