peek-elasticsearch 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +11 -1
- data/lib/peek/views/elasticsearch.rb +6 -2
- data/peek-elasticsearch.gemspec +1 -1
- metadata +1 -1
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
|
-
|
|
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
|
|
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 => (
|
|
50
|
+
:inactive => (number_of_shards + number_of_replicas - active_shards),
|
|
47
51
|
:status => status
|
|
48
52
|
}
|
|
49
53
|
end
|
data/peek-elasticsearch.gemspec
CHANGED