Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bastelfreak/elk-maintenance
https://github.com/bastelfreak/elk-maintenance
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bastelfreak/elk-maintenance
- Owner: bastelfreak
- License: gpl-3.0
- Created: 2017-10-30T09:26:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T19:26:56.000Z (about 7 years ago)
- Last Synced: 2024-10-19T22:13:00.669Z (3 months ago)
- Language: Ruby
- Size: 30.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elasticsearch maintenance foo
## Install deps
```sh
bundle install --path .vendor/
```## Count docs
```ruby
client = Elasticsearch::Client.new
docs = client.cluster.stats['indices']['docs']['count']
until false
docs2 = client.cluster.stats['indices']['docs']['count']
puts "docs in last 10s: #{docs2 - docs}"
docs = docs2
sleep 10
end
```Or in more beautiful:
```ruby
client = Elasticsearch::Client.new
a = client.cluster.stats.dig("indices","docs","count")
loop do
sleep 1
x = client.cluster.stats.dig("indices","docs","count")
print "\r#{x-a} "
a = x
end
```
## Infos about a node```ruby
puts client.cluster.stats
```## Stats about nodes
```ruby
client.nodes.stats
```## Infos about nodes
```ruby
client.nodes.infos
```