Example #1
0
class ESSchema(SchemaBase):
    """docstring for ESSchema"""
    def __init__(self, url, **kw):
        super(ESSchema, self).__init__(url, **kw)
        hosts = ['%s:%s' % host for host in self.url['hosts']]
        self.es = Elasticsearch(hosts, )
        
    def get_indices(self, names):
        return self.es.indices(names)

    def get_schema_names(self):
    	pass

    def get_schema_info(self):
        schema = {}
        schema['table'] = self.get_table_info()
        return schema
Example #2
0
class Signposts:

    def __init__(self, uri, user_id, password):
        self.es = Elasticsearch([uri],http_auth= (user_id, password))
        self.indexes = {}

    def create_index_or_add_event(self, index, document_type ,document_body):
        """Adds document_body"""
        self.es.create(index,id=uuid.uuid4().hex ,doc_type=document_type, body=document_body )

    def search_index(self):
        pass

    def search_indexes(self):
        pass

    def get_index_names(self):
        index_names = self.es.indices()
        return index_names

    def get_document(self, id, index):
        pass