Module: ICFS::Elastic
- Included in:
- CacheElastic
- Defined in:
- lib/icfs/elastic.rb
Overview
Shared Elasticsearch methods
Instance Method Summary collapse
-
#create(maps) ⇒ Object
Create ES indices.
Instance Method Details
#create(maps) ⇒ Object
Create ES indices
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/icfs/elastic.rb', line 66 def create(maps) head = {'Content-Type'.freeze => 'application/json'.freeze}.freeze maps.each do |ix, map| url = @map[ix] resp = @es.run_request(:put, url, map, head) if !resp.success? puts 'URL: %s' % url puts map puts resp.body raise('Elasticsearch index create failed: %s'.freeze % ix.to_s) end end end |