Removing prototyped API implementations for more robust versions to come
This commit is contained in:
@@ -84,51 +84,4 @@ class Elasticsearch(object):
|
|||||||
"""
|
"""
|
||||||
self.transport = Transport(_normalize_hosts(hosts), **kwargs)
|
self.transport = Transport(_normalize_hosts(hosts), **kwargs)
|
||||||
|
|
||||||
@query_params('timeout')
|
|
||||||
def create_index(self, index, body=None, params=None):
|
|
||||||
status, data = self.transport.perform_request('PUT', '/%s' % quote_plus(index), params=params, body=body)
|
|
||||||
return data
|
|
||||||
|
|
||||||
@query_params()
|
|
||||||
def delete_index(self, index='', ignore_missing=False, params=None):
|
|
||||||
index = _normalize_list(index)
|
|
||||||
try:
|
|
||||||
status, data = self.transport.perform_request('DELETE', '/%s' % quote_plus(index), params=params)
|
|
||||||
except NotFoundError:
|
|
||||||
if ignore_missing:
|
|
||||||
return
|
|
||||||
raise
|
|
||||||
return data
|
|
||||||
|
|
||||||
@query_params()
|
|
||||||
def refresh(self, index=None, params=None):
|
|
||||||
url = '/_refresh'
|
|
||||||
if index:
|
|
||||||
url = '/%s/_refresh' % _normalize_list(index)
|
|
||||||
status, data = self.transport.perform_request('POST', url, params=params)
|
|
||||||
return data
|
|
||||||
|
|
||||||
@query_params('consistency', 'op_type', 'parent', 'percolate', 'refresh', 'replication', 'routing', 'timeout', 'timestamp', 'ttl', 'version', 'version_type')
|
|
||||||
def index(self, index, doc_type, body, id=None, params=None):
|
|
||||||
status, data = self.transport.perform_request('PUT', '/%s/%s/%s' % map(quote_plus, (index, doc_type, str(id))), params=params, body=body)
|
|
||||||
return data
|
|
||||||
|
|
||||||
@query_params('fields', 'parent', 'preference', 'realtime', 'refresh', 'routing', 'timeout')
|
|
||||||
def get(self, index, id, doc_type=u'_all', params=None):
|
|
||||||
status, data = self.transport.perform_request('GET', '/%s/%s/%s' % map(quote_plus, (index, doc_type, str(id))), params=params)
|
|
||||||
return data
|
|
||||||
|
|
||||||
@query_params('explain', 'fields', 'from', 'ignore_indices', 'indices_boost', 'preference', 'routing', 'search_type', 'size', 'sort', 'source', 'stats', 'timeout', 'version')
|
|
||||||
def search(self, query, index='_all', doc_type=None, params=None):
|
|
||||||
body = None
|
|
||||||
if isinstance(query, (type(''), type(u''))):
|
|
||||||
params['q'] = query
|
|
||||||
else:
|
|
||||||
body = query
|
|
||||||
|
|
||||||
url = '/%s/%s/_search' % (_normalize_list(index), _normalize_list(doc_type)) if doc_type else '/%s/_search' % _normalize_list(index)
|
|
||||||
|
|
||||||
status, data = self.transport.perform_request('GET', url, params=params, body=body)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user