def all_indexes(): return ",".join(( collections_index(), notifications_index(), xref_index(), entities_read_index(), ))
def get_notifications(role, since=None, parser=None): """Fetch a stream of notifications for the given role.""" channels = get_role_channels(role) filters = [{'terms': {'channels': channels}}] if since is not None: filters.append({'range': {'created_at': {'gt': since}}}) must_not = [{'term': {'actor_id': role.id}}] query = { 'size': 30, 'query': { 'bool': { 'filter': filters, 'must_not': must_not } }, 'sort': [{ 'created_at': { 'order': 'desc' } }] } if parser is not None: query['size'] = parser.limit query['from'] = parser.offset return es.search(index=notifications_index(), body=query)
def get_notifications(role, since=None): """Fetch a stream of notifications for the given role.""" channels = get_role_channels(role) filters = [{"terms": {"channels": channels}}] if since is not None: filters.append({"range": {"created_at": {"gt": since}}}) must_not = [{"term": {"actor_id": role.id}}] query = { "size": 30, "query": {"bool": {"filter": filters, "must_not": must_not}}, "sort": [{"created_at": {"order": "desc"}}], } return es.search(index=notifications_index(), body=query)
def get_index(self): return notifications_index()