class RestClient
Public Class Methods
new(host: '127.0.0.1', port: 9200)
click to toggle source
# File lib/rest_client.rb, line 3 def initialize host: '127.0.0.1', port: 9200 @client = Elasticsearch::Client.new(host: host, port: port) end
Public Instance Methods
bulk(*args)
click to toggle source
# File lib/rest_client.rb, line 19 def bulk *args return @client.bulk(*args) end
create(*args)
click to toggle source
# File lib/rest_client.rb, line 23 def create *args return @client.create(*args) end
delete(*args)
click to toggle source
# File lib/rest_client.rb, line 27 def delete *args return @client.delete(*args) end
delete_by_query(*args)
click to toggle source
# File lib/rest_client.rb, line 31 def delete_by_query *args args.first[:body] = SearchSourceBuilder.new.query(args.first[:body]).body return @client.delete_by_query(*args) end
get(*args)
click to toggle source
# File lib/rest_client.rb, line 36 def get *args return @client.get(*args) end
index(*args)
click to toggle source
# File lib/rest_client.rb, line 15 def index *args return @client.index(*args) end
mget(*args)
click to toggle source
# File lib/rest_client.rb, line 40 def mget *args return @client.mget(*args) end
msearch(msearch_request)
click to toggle source
# File lib/rest_client.rb, line 11 def msearch msearch_request return @client.msearch(body: msearch_request.body) end
search(search_request)
click to toggle source
# File lib/rest_client.rb, line 7 def search search_request return @client.search(index: search_request.attributes.index, body: search_request.body) end
update(*args)
click to toggle source
# File lib/rest_client.rb, line 44 def update *args return @client.update(*args) end
update_by_query(*args)
click to toggle source
# File lib/rest_client.rb, line 48 def update_by_query *args args.first[:body] = SearchSourceBuilder.new.query(args.first[:body]).body return @client.update_by_query(*args) end