def send_to_elasticsearch(index_name, doc, delete=False, es_merge_update=False): """ Utility method to update the doc in elasticsearch. Duplicates the functionality of pillowtop but can be called directly. """ from pillowtop.es_utils import ElasticsearchIndexInfo doc_id = doc['_id'] es_meta = ES_META[index_name] index_info = ElasticsearchIndexInfo(index=es_meta.index, type=es_meta.type) doc_exists = doc_exists_in_es(index_info, 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_name), data=doc, except_on_failure=True, update=doc_exists, delete=delete, es_merge_update=es_merge_update, )
def send_to_elasticsearch(index_name, doc, delete=False, es_merge_update=False): """ Utility method to update the doc in elasticsearch. Duplicates the functionality of pillowtop but can be called directly. """ from pillowtop.es_utils import ElasticsearchIndexInfo doc_id = doc['_id'] if isinstance(doc_id, bytes): doc_id = doc_id.decode('utf-8') es_meta = ES_META[index_name] index_info = ElasticsearchIndexInfo(index=es_meta.index, type=es_meta.type) doc_exists = doc_exists_in_es(index_info, 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_name), data=doc, except_on_failure=True, update=doc_exists, delete=delete, es_merge_update=es_merge_update, )
def send_to_elasticsearch(index_name, doc, delete=False, es_merge_update=False): """ Utility method to update the doc in elasticsearch. Duplicates the functionality of pillowtop but can be called directly. """ doc_id = doc['_id'] if isinstance(doc_id, bytes): doc_id = doc_id.decode('utf-8') index_info = ES_META[index_name] doc_exists = doc_exists_in_es(index_info, doc_id) return send_to_es( alias=index_info.alias, doc_type=index_info.type, doc_id=doc_id, es_getter=get_es_new, name="{}.{} <{}>:".format(send_to_elasticsearch.__module__, send_to_elasticsearch.__name__, index_name), data=doc, propagate_failure=True, update=doc_exists, delete=delete, es_merge_update=es_merge_update, )
def send_to_elasticsearch(index_cname, doc, delete=False, es_merge_update=False): """ Utility method to update the doc in elasticsearch. Duplicates the functionality of pillowtop but can be called directly. """ doc_id = doc['_id'] if isinstance(doc_id, bytes): doc_id = doc_id.decode('utf-8') index_info = registry_entry(index_cname) return send_to_es( index_info=index_info, doc_type=index_info.type, doc_id=doc_id, es_getter=get_client, name="{}.{} <{}>:".format(send_to_elasticsearch.__module__, send_to_elasticsearch.__name__, index_cname), data=doc, delete=delete, es_merge_update=es_merge_update, )