peek-elasticsearch 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,6 +18,16 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
+ First, make sure somewhere in your app you're defining `$stretch`.
22
+ [Stretch](https://github.com/wfarr/stretch) is a simple, bare-bones
23
+ Elasticsearch client.
24
+
25
+ For example:
26
+
21
27
  ``` ruby
22
- Peek.into Peek::Views::Elasticsearch, :index => 'myapp-stuff'
28
+ # config/initializers/elasticsearch.rb
29
+ $stretch = Stretch::Client.new :url => 'http://127.0.0.1:9200/'
30
+
31
+ # config/initializers/peek.rb
32
+ Peek.into Peek::Views::Elasticsearch, :index => "myapp-#{Rails.env}"
23
33
  ```
@@ -29,10 +29,14 @@ module Peek
29
29
  index_health["active_shards"]
30
30
  end
31
31
 
32
- def total_shards
32
+ def number_of_shards
33
33
  index_health["number_of_shards"]
34
34
  end
35
35
 
36
+ def number_of_replicas
37
+ index_health["number_of_replicas"]
38
+ end
39
+
36
40
  def context
37
41
  {
38
42
  :primaries => active_primary_shards,
@@ -43,7 +47,7 @@ module Peek
43
47
  def results
44
48
  {
45
49
  :active => active_shards,
46
- :inactive => (total_shards - active_shards),
50
+ :inactive => (number_of_shards + number_of_replicas - active_shards),
47
51
  :status => status
48
52
  }
49
53
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "peek-elasticsearch"
5
- spec.version = "0.1.1"
5
+ spec.version = "0.1.2"
6
6
  spec.authors = ["Will Farrington"]
7
7
  spec.email = ["wfarr@github.com"]
8
8
  spec.description = %q{Take a peek into your Elasticsearch indices.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peek-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: