Module: Khoj::Index
Instance Method Summary collapse
Instance Method Details
#create_index ⇒ Object
4 5 6 7 |
# File 'lib/khoj/index.rb', line 4 def create_index response = @conn.put("/#{_index}") response.code == 200 ? true : (raise KhojException.new(response.parsed_response)) end |
#delete_index ⇒ Object
9 10 11 12 |
# File 'lib/khoj/index.rb', line 9 def delete_index response = @conn.delete("/#{_index}") response.code == 200 ? true : (raise KhojException.new(response.parsed_response)) end |
#index? ⇒ Boolean
14 15 16 |
# File 'lib/khoj/index.rb', line 14 def index? @conn.head("/#{_index}").code == 200 ? true : false end |
#index_stats ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/khoj/index.rb', line 18 def index_stats response = @conn.get("/#{_index }/_stats") if response.code == 200 response.parsed_response['_all']['total']['docs']['count'] else raise KhojException.new(response.parsed_response) end end |