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

Returns a new instance of Indices.

Parameters:

  • indices (Hash{String=>Hash})

    A Hash with the information about the indices. Its keys are the names of the indices, its values hashes with information about each of the 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>

Returns A lazy enumerator of Index objects, one for each of the indexes. All indices (system and user-defined are included).

Returns:

  • (Enumerator::Lazy<JayAPI::Elasticsearch::Stats::Index>)

    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

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

Returns A lazy enumerator of Index objects. Includes only the system indices.

Returns:



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>

Returns A lazy enumerator of Index objects. Includes only the user-defined indices.

Returns:



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

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