diff --git a/lib/elastic_search_helper.rb b/lib/elastic_search_helper.rb index 58f470c..d61412a 100644 --- a/lib/elastic_search_helper.rb +++ b/lib/elastic_search_helper.rb @@ -9,7 +9,7 @@ class ElasticSearchHelper @pastebinner = Pastebinner.new(ENV['pastebin_api_key'], ENV['pastebin_username'], ENV['pastebin_password']) end - def create_index + def create_index_with_mappings header = { 'Content-type': 'application/json' } response = RestClient::Request.execute( method: :put, @@ -18,6 +18,19 @@ class ElasticSearchHelper payload: self.mappings.to_json) end + def delete_index + response = RestClient::Request.execute( + method: :delete, + url: "#{server_uri}/#{index}") + end + + def get_mappings + response = RestClient::Request.execute( + method: :get, + url: "#{server_uri}/#{index}/_mappings") + end + + def mappings { "mappings": {