added method to es helper to delete index and get mappings
This commit is contained in:
parent
6f715c3f86
commit
bf64a2f60e
1 changed files with 14 additions and 1 deletions
|
@ -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": {
|
||||
|
|
Loading…
Add table
Reference in a new issue