text
stringlengths 0
828
|
|---|
ERROR: type should be string, got " https://github.com/elasticsearch/elasticsearch-river-couchdb"
|
Creates a river for the specified couchdb_db.
|
> search = ElasticSearch()
|
> search.river_couchdb_create('feeds','feeds','feeds')
|
{u'_id': u'_meta',
|
u'_index': u'_river',
|
u'_type': u'test_db',
|
u'_version': 1,
|
u'ok': True}
|
'''
|
request = self.session
|
if not index_type:
|
index_type = index_name
|
if not couchdb_db:
|
couchdb_db = index_name
|
content = {
|
'type' : 'couchdb',
|
'couchdb' : {
|
'host' : couchdb_host,
|
'port' : couchdb_port,
|
'db' : couchdb_db,
|
'filter' : couchdb_filter
|
},
|
'index' : {
|
'index' : index_name,
|
'type' : index_type
|
}
|
}
|
if couchdb_user and couchdb_password:
|
content['couchdb']['user'] = couchdb_user
|
content['couchdb']['password'] = couchdb_password
|
if script:
|
content['couchdb']['script'] = script
|
if self.verbose:
|
print content
|
url = 'http://%s:%s/_river/%s/_meta' %(self.host, self.port, river_name or index_name)
|
response = request.post(url,content)
|
return response"
|
660,"def river_couchdb_delete(self, index_name):
|
'''
|
ERROR: type should be string, got " https://github.com/elasticsearch/elasticsearch-river-couchdb"
|
Delete's a river for the specified index
|
WARNING: It DOES NOT delete the index, only the river, so the only effects of this are that the index will no longer poll CouchDB for updates.
|
'''
|
request = self.session
|
url = 'http://%s:%s/_river/%s' % (self.host, self.port, index_name)
|
response = request.delete(url)
|
return response"
|
661,"def index_list(self):
|
'''
|
Lists indices
|
'''
|
request = self.session
|
url = 'http://%s:%s/_cluster/state/' % (self.host, self.port)
|
response = request.get(url)
|
if request.status_code==200:
|
return response.get('metadata',{}).get('indices',{}).keys()
|
else:
|
return response"
|
662,"def map(self,index_name, index_type, map_value):
|
'''
|
Enable a specific map for an index and type
|
'''
|
request = self.session
|
url = 'http://%s:%s/%s/%s/_mapping' % (self.host, self.port, index_name, index_type)
|
content = { index_type : { 'properties' : map_value } }
|
if self.verbose:
|
print content
|
response = request.put(url,content)
|
return response"
|
663,"def list_types(index_name, host='localhost',port='9200'):
|
'''
|
Lists the context types available in an index
|
'''
|
return ElasticSearch(host=host, port=port).type_list(index_name)"
|
664,"def type_list(self, index_name):
|
'''
|
List the types available in an index
|
'''
|
request = self.session
|
url = 'http://%s:%s/%s/_mapping' % (self.host, self.port, index_name)
|
response = request.get(url)
|
if request.status_code == 200:
|
return response[index_name].keys()
|
else:
|
return response"
|
665,"def raw(self, module, method='GET', data=None):
|
'''
|
Submits or requsts raw input
|
'''
|
request = self.session
|
url = 'http://%s:%s/%s' % (self.host, self.port, module)
|
if self.verbose:
|
print data
|
if method=='GET':
|
response = request.get(url)
|
elif method=='POST':
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.