Skip to content

Instantly share code, notes, and snippets.

@ernestas-poskus
Created June 13, 2017 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ernestas-poskus/8830471689b257af6c386af85549f852 to your computer and use it in GitHub Desktop.
Save ernestas-poskus/8830471689b257af6c386af85549f852 to your computer and use it in GitHub Desktop.
Elasticsearch shards matrix
m = []
size = 15
def shards(s, r)
s * r + s
end
size.times { |y| m << Array(0..size).map { |x| shards(y, x) }.join(' | ') }
print '| '
size.times { |header| print "| #{header} " }
puts '|'
size.times { |header| print "| - " }
puts '| - |'
m.each_with_index do |row, index|
next if index == 0
print "| #{index} | #{row} |"
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment