(index_info, doc_type, doc_id, es_getter, name, data=None,
                          delete=False, es_merge_update=False)
More fault tolerant es.put method
    kwargs:
        es_merge_update: Set this to True to use Elasticsearch.update instead of Elasticsearch.index
            which merges existing ES doc and current update. If this is set to False, the doc will be replaced
More fault tolerant es.put method
    kwargs:
        es_merge_update: Set this to True to use Elasticsearch.update instead of Elasticsearch.index
            which merges existing ES doc and current update. If this is set to False, the doc will be replaced
More fault tolerant es . put method kwargs : es_merge_update : Set this to True to use Elasticsearch . update instead of Elasticsearch . index which merges existing ES doc and current update . If this is set to False the doc will be replaced
def send_to_elasticsearch(index_info, doc_type, doc_id, es_getter, name, data=None,
                          delete=False, es_merge_update=False):
    """
    More fault tolerant es.put method
    kwargs:
        es_merge_update: Set this to True to use Elasticsearch.update instead of Elasticsearch.index
            which merges existing ES doc and current update. If this is set to False, the doc will be replaced

    """
    alias = index_info.alias
    data = data if data is not None else {}
    current_tries = 0
    es_interface = _get_es_interface(es_getter)
    retries = _retries()
    propagate_failure = _propagate_failure()
    while current_tries < retries:
        try:
            if delete:
                es_interface.delete_doc(alias, doc_type, doc_id)
            else:
                if es_merge_update:
                    # The `retry_on_conflict` param is only valid on `update`
                    # requests. ES <5.x was lenient of its presence on `index`
                    # requests, ES >=5.x is not.
                    params = {'retry_on_conflict': 2}
                    es_interface.update_doc_fields(alias, doc_type, doc_id,
                                                   fields=data, params=params)
                else:
                    # use the same index API to create or update doc
                    es_interface.index_doc(alias, doc_type, doc_id, doc=data)
            break
        except ConnectionError:
            current_tries += 1
            if current_tries == retries:
                message = "[%s] Max retry error on %s/%s/%s"
                args = (name, alias, doc_type, doc_id)
                if propagate_failure:
                    raise PillowtopIndexingError(message % args)
                else:
                    pillow_logging.exception(message, *args)
            else:
                pillow_logging.exception("[%s] put_robust error attempt %s/%s", name, current_tries, retries)

            _sleep_between_retries(current_tries)
        except RequestError:
            message = "[%s] put_robust error: %s/%s/%s"
            args = (name, alias, doc_type, doc_id)
            if propagate_failure:
                raise PillowtopIndexingError(message % args)
            else:
                pillow_logging.exception(message, *args)
            break
        except ConflictError:
            break  # ignore the error if a doc already exists when trying to create it in the index
        except NotFoundError:
            break
def send_to_elasticsearch ( index_info , doc_type , doc_id , es_getter , name , data = None , delete = False , es_merge_update = False ) : alias = index_info . alias data = data if data is not None else { } current_tries = 0 es_interface = _get_es_interface ( es_getter ) retries = _retries ( ) propagate_failure = _propagate_failure ( ) while current_tries < retries : try : if delete : es_interface . delete_doc ( alias , doc_type , doc_id ) else : if es_merge_update : # The `retry_on_conflict` param is only valid on `update` # requests. ES <5.x was lenient of its presence on `index` # requests, ES >=5.x is not. params = { 'retry_on_conflict' : 2 } es_interface . update_doc_fields ( alias , doc_type , doc_id , fields = data , params = params ) else : # use the same index API to create or update doc es_interface . index_doc ( alias , doc_type , doc_id , doc = data ) break except ConnectionError : current_tries += 1 if current_tries == retries : message = "[%s] Max retry error on %s/%s/%s" args = ( name , alias , doc_type , doc_id ) if propagate_failure : raise PillowtopIndexingError ( message % args ) else : pillow_logging . exception ( message , * args ) else : pillow_logging . exception ( "[%s] put_robust error attempt %s/%s" , name , current_tries , retries ) _sleep_between_retries ( current_tries ) except RequestError : message = "[%s] put_robust error: %s/%s/%s" args = ( name , alias , doc_type , doc_id ) if propagate_failure : raise PillowtopIndexingError ( message % args ) else : pillow_logging . exception ( message , * args ) break except ConflictError : break # ignore the error if a doc already exists when trying to create it in the index except NotFoundError : break