def __init__(self): # serializer = JSONSerializer() serializer.mimetype = 'application/json' serializer.dumps = serializer.serialize serializer.loads = JSONDeserializer().deserialize self.es = Elasticsearch(hosts=settings.ELASTICSEARCH_HOSTS, serializer=serializer, **settings.ELASTICSEARCH_CONNECTION_OPTIONS) self.logger = logging.getLogger(__name__)
def __init__(self, **kwargs): # serializer = JSONSerializer() serializer.mimetype = "application/json" serializer.dumps = serializer.serialize serializer.loads = JSONDeserializer().deserialize self.prefix = kwargs.pop("prefix", "").lower() self.es = Elasticsearch(serializer=serializer, **kwargs) self.logger = logging.getLogger(__name__)