Skip to content

Instantly share code, notes, and snippets.

@inokappa
Created December 8, 2013 01:07
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 inokappa/7852116 to your computer and use it in GitHub Desktop.
Save inokappa/7852116 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'digest/md5'
index_param = "testpost"
type_param = "test3"
while line = gets
rdm = ((0..9).to_a + ("a".."z").to_a + ("A".."Z").to_a).sample(3).join
id = Digest::MD5.new.update("#{rdm}")
puts "{ \"index\" : { \"_index\" : \"#{index_param}\", \"_type\" : \"#{type_param}\", \"_id\" : \"#{id}\" } }"
puts line
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment