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

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

Overview

Contains information about an index’s totals (docs, used space, etc).

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Totals

Returns a new instance of Totals.

Parameters:

  • data (Hash)

    The data under the index’s total key.



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

def initialize(data)
  @data = data
end

Instance Method Details

#deleted_docsInteger

Returns The total number of deleted documents in the index.

Returns:

  • (Integer)

    The total number of deleted documents in the index.



20
21
22
# File 'lib/jay_api/elasticsearch/stats/index/totals.rb', line 20

def deleted_docs
  @deleted_docs ||= docs.fetch('deleted')
end

#deleted_ratioFloat

Returns A number between 0 and 1 that represents the ratio of between deleted documents and total documents in the index.

Returns:

  • (Float)

    A number between 0 and 1 that represents the ratio of between deleted documents and total documents in the index.



26
27
28
# File 'lib/jay_api/elasticsearch/stats/index/totals.rb', line 26

def deleted_ratio
  @deleted_ratio ||= calculate_deleted_ratio
end

#docs_countInteger

Returns The total number of documents in the index.

Returns:

  • (Integer)

    The total number of documents in the index.



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

def docs_count
  @docs_count ||= docs.fetch('count')
end