Class: ES::Client
- Inherits:
-
Object
- Object
- ES::Client
- Defined in:
- lib/es/client.rb
Instance Method Summary collapse
- #bulk(requests, path = nil) ⇒ Object
- #create_index(path, data) ⇒ Object
- #delete_index(path) ⇒ Object
- #get(path) ⇒ Object
- #get_mapping(path) ⇒ Object
- #index(path, data) ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #scroll(params = {}) ⇒ Object
- #search(path, data, params = {}) ⇒ Object
- #update(path, data) ⇒ Object
Constructor Details
Instance Method Details
#bulk(requests, path = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/es/client.rb', line 11 def bulk(requests, path = nil) serialized = requests.map do |r| serialize(r) + "\n" end.join('') response = @client.bulk(serialized, path) @dumper.load(response) end |
#create_index(path, data) ⇒ Object
49 50 51 52 53 |
# File 'lib/es/client.rb', line 49 def create_index(path, data) serialized = serialize(data) response = @client.create_index(path, serialized) @dumper.load(response) end |
#delete_index(path) ⇒ Object
55 56 57 58 |
# File 'lib/es/client.rb', line 55 def delete_index(path) response = @client.delete_index(path) @dumper.load(response) end |
#get(path) ⇒ Object
21 22 23 24 |
# File 'lib/es/client.rb', line 21 def get(path) response = @client.get(path) @dumper.load(response) end |
#get_mapping(path) ⇒ Object
60 61 62 63 |
# File 'lib/es/client.rb', line 60 def get_mapping(path) response = @client.get_mapping(path) @dumper.load(response) end |
#index(path, data) ⇒ Object
26 27 28 29 30 |
# File 'lib/es/client.rb', line 26 def index(path, data) serialized = serialize(data) response = @client.index(path, serialized) @dumper.load(response) end |
#scroll(params = {}) ⇒ Object
38 39 40 41 |
# File 'lib/es/client.rb', line 38 def scroll(params = {}) response = @client.scroll(params) @dumper.load(response) end |
#search(path, data, params = {}) ⇒ Object
32 33 34 35 36 |
# File 'lib/es/client.rb', line 32 def search(path, data, params = {}) serialized = serialize(data) response = @client.search(path, serialized, params) @dumper.load(response) end |
#update(path, data) ⇒ Object
43 44 45 46 47 |
# File 'lib/es/client.rb', line 43 def update(path, data) serialized = serialize(data) response = @client.update(path, serialized) @dumper.load(response) end |