Beispiel #1
0
def send_to_elasticsearch(index, doc, delete=False):
    """
    Utility method to update the doc in elasticsearch.
    Duplicates the functionality of pillowtop but can be called directly.
    """
    doc_id = doc['_id']
    path = ES_URLS[index].replace('_search', doc_id)
    doc_exists = get_es().head(path)
    return send_to_es(
        path=path,
        es_getter=get_es,
        name="{}.{} <{}>:".format(send_to_elasticsearch.__module__,
                                  send_to_elasticsearch.__name__, index),
        data=doc,
        except_on_failure=True,
        update=doc_exists,
        delete=delete,
    )
Beispiel #2
0
def send_to_elasticsearch(index, doc, delete=False):
    """
    Utility method to update the doc in elasticsearch.
    Duplicates the functionality of pillowtop but can be called directly.
    """
    doc_id = doc['_id']
    path = ES_URLS[index].replace('_search', doc_id)
    doc_exists = get_es().head(path)
    return send_to_es(
        path=path,
        es_getter=get_es,
        name="{}.{} <{}>:".format(send_to_elasticsearch.__module__,
                                  send_to_elasticsearch.__name__, index),
        data=doc,
        except_on_failure=True,
        update=doc_exists,
        delete=delete,
    )
Beispiel #3
0
def send_to_elasticsearch(index, doc, delete=False):
    """
    Utility method to update the doc in elasticsearch.
    Duplicates the functionality of pillowtop but can be called directly.
    """
    doc_id = doc['_id']
    es_meta = ES_META[index]
    doc_exists = doc_exists_in_es(index, doc_id)
    return send_to_es(
        index=es_meta.index,
        doc_type=es_meta.type,
        doc_id=doc_id,
        es_getter=get_es_new,
        name="{}.{} <{}>:".format(send_to_elasticsearch.__module__,
                                  send_to_elasticsearch.__name__, index),
        data=doc,
        except_on_failure=True,
        update=doc_exists,
        delete=delete,
    )