class MeiliSearch::Client
Public Instance Methods
create_dump()
click to toggle source
DUMPS
# File lib/meilisearch/client.rb, line 79 def create_dump http_post '/dumps' end
create_index(index_uid, options = {})
click to toggle source
Usage: client.create_index('indexUID') client.create_index('indexUID', primaryKey: 'id')
# File lib/meilisearch/client.rb, line 16 def create_index(index_uid, options = {}) body = options.merge(uid: index_uid) index_hash = http_post '/indexes', body index_object(index_hash['uid'], index_hash['primaryKey']) end
delete_index(index_uid)
click to toggle source
# File lib/meilisearch/client.rb, line 33 def delete_index(index_uid) index_object(index_uid).delete end
dump_status(dump_uid)
click to toggle source
# File lib/meilisearch/client.rb, line 83 def dump_status(dump_uid) http_get "/dumps/#{dump_uid}/status" end
Also aliased as: get_dump_status
fetch_index(index_uid)
click to toggle source
# File lib/meilisearch/client.rb, line 43 def fetch_index(index_uid) index_object(index_uid).fetch_info end
get_or_create_index(index_uid, options = {})
click to toggle source
# File lib/meilisearch/client.rb, line 22 def get_or_create_index(index_uid, options = {}) begin index_instance = fetch_index(index_uid) rescue ApiError => e raise e unless e.code == 'index_not_found' index_instance = create_index(index_uid, options) end index_instance end
health()
click to toggle source
# File lib/meilisearch/client.rb, line 63 def health http_get '/health' end
healthy?()
click to toggle source
HEALTH
# File lib/meilisearch/client.rb, line 56 def healthy? http_get '/health' true rescue StandardError false end
index(index_uid)
click to toggle source
Usage: client.index('indexUID')
# File lib/meilisearch/client.rb, line 39 def index(index_uid) index_object(index_uid) end
indexes()
click to toggle source
INDEXES
# File lib/meilisearch/client.rb, line 9 def indexes http_get '/indexes' end
keys()
click to toggle source
KEYS
# File lib/meilisearch/client.rb, line 49 def keys http_get '/keys' end
Also aliased as: get_keys
stats()
click to toggle source
# File lib/meilisearch/client.rb, line 73 def stats http_get '/stats' end
version()
click to toggle source
STATS
# File lib/meilisearch/client.rb, line 69 def version http_get '/version' end
Private Instance Methods
index_object(uid, primary_key = nil)
click to toggle source
# File lib/meilisearch/client.rb, line 90 def index_object(uid, primary_key = nil) Index.new(uid, @base_url, @api_key, primary_key, @options) end