def __init__(self): self.conn = get_es(biothing_settings.es_host) self.ES_INDEX_NAME = 'userfilters' self.ES_DOC_TYPE = 'filter' self._MAPPING = { "dynamic": False, "properties": {} } # this mapping disables indexing completely since we don't need it.
def __init__(self, settings): self._es = get_es(settings.es_host) self._index = settings.es_index self._doc_type = settings.es_doc_type self._allowed_options = settings.allowed_options or ALLOWED_OPTIONS self._scroll_time = settings.scroll_time self._total_scroll_size = settings.scroll_size # Total number of hits to return per scroll batch self._settings = settings if self._total_scroll_size % self.get_number_of_shards() == 0: # Total hits per shard per scroll batch self._scroll_size = int(self._total_scroll_size / self.get_number_of_shards()) else: raise ScrollSetupError("_total_scroll_size of {} can't be ".format(self._total_scroll_size) + "divided evenly among {} shards.".format(self.get_number_of_shards()))
def __init__(self): self._es = get_es(biothing_settings.es_host) self._index = biothing_settings.es_index self._doc_type = biothing_settings.es_doc_type self._allowed_options = biothing_settings.allowed_options self._scroll_time = biothing_settings.scroll_time self._total_scroll_size = biothing_settings.scroll_size # Total number of hits to return per scroll batch self._default_fields = [] try: self._context = json.load(open(biothing_settings.jsonld_context_path, 'r')) except FileNotFoundError: self._context = {} if self._total_scroll_size % self.get_number_of_shards() == 0: # Total hits per shard per scroll batch self._scroll_size = int(self._total_scroll_size / self.get_number_of_shards()) else: raise ScrollSetupError("_total_scroll_size of {} can't be ".format(self._total_scroll_size) + "divided evenly among {} shards.".format(self.get_number_of_shards()))