Class: JayAPI::Elasticsearch::Stats::Indices

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(indices) ⇒ Indices



18
19
20
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 18

def initialize(indices)
  @indices = indices
end

Instance Method Details

#allEnumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>



25
26
27
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 25

def all
  @all ||= with_lazy_instantiation { indices }
end

#systemEnumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>



31
32
33
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 31

def system
  @system ||= with_lazy_instantiation { indices.select(&SYSTEM_SELECTOR) }
end

#userEnumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>



38
39
40
# File 'lib/jay_api/elasticsearch/stats/indices.rb', line 38

def user
  @user ||= with_lazy_instantiation { indices.reject(&SYSTEM_SELECTOR) }
end