def save(self, data, **kwargs):
        """ sends a passed in action_list to elasticsearch

        args:
            data: that data dictionary to save

        kwargs:
            id: es id to use / None = auto
            """

        lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3]))
        lg.setLevel(self.log_level)

        es = self.es
        es_index = get2(kwargs, "es_index", self.es_index)
        reset_index = kwargs.get("reset_index",self.reset_index)
        doc_type = kwargs.get("doc_type", self.doc_type)
        op_type = kwargs.get("op_type", self.op_type)
        id_value = kwargs.get("id")
        id_field = kwargs.get("id_field")
        if id_field:
            id_value = data.get(id_field)
        if op_type == "index":
            result = es.index(index=es_index,
                               id=id_value,
                               doc_type=doc_type,
                               body=data)
        elif op_type == "create":
            result = es.create(index=es_index,
                               id=id_value,
                               doc_type=doc_type,
                               body=data)

        lg.debug("Result = \n%s",pp.pformat(result))
        return result
def save ( self , data , ** kwargs ) : lg = logging . getLogger ( "%s.%s" % ( self . ln , inspect . stack ( ) [ 0 ] [ 3 ] ) ) lg . setLevel ( self . log_level ) es = self . es es_index = get2 ( kwargs , "es_index" , self . es_index ) reset_index = kwargs . get ( "reset_index" , self . reset_index ) doc_type = kwargs . get ( "doc_type" , self . doc_type ) op_type = kwargs . get ( "op_type" , self . op_type ) id_value = kwargs . get ( "id" ) id_field = kwargs . get ( "id_field" ) if id_field : id_value = data . get ( id_field ) if op_type == "index" : result = es . index ( index = es_index , id = id_value , doc_type = doc_type , body = data ) elif op_type == "create" : result = es . create ( index = es_index , id = id_value , doc_type = doc_type , body = data ) lg . debug ( "Result = \n%s" , pp . pformat ( result ) ) return result
sends a passed in action_list to elasticsearch

        args:
            data: that data dictionary to save

        kwargs:
            id: es id to use / None = auto