Class: JayAPI::Elasticsearch::Stats::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_api/elasticsearch/stats/index.rb,
lib/jay_api/elasticsearch/stats/index/totals.rb

Overview

Holds information about an Elasticsearch Index.

Defined Under Namespace

Classes: Totals

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, data) ⇒ Index

Returns a new instance of Index.

Parameters:

  • name (String)

    The name of the index.

  • data (Hash)

    Information about the index.



14
15
16
17
# File 'lib/jay_api/elasticsearch/stats/index.rb', line 14

def initialize(name, data)
  @name = name
  @data = data
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/jay_api/elasticsearch/stats/index.rb', line 10

def name
  @name
end

Instance Method Details

#totalsJayAPI::Elasticsearch::Stats::Index::Totals

Returns Information about the index’s total metrics.

Returns:

Raises:

  • (KeyError)

    If the given data doesn’t have a total key.



22
23
24
# File 'lib/jay_api/elasticsearch/stats/index.rb', line 22

def totals
  @totals ||= ::JayAPI::Elasticsearch::Stats::Index::Totals.new(data.fetch('total'))
end