

def expand_action(data):
    "\n    From one document or action definition passed in by the user extract the\n    action/data lines needed for elasticsearch's\n    :meth:`~elasticsearch.Elasticsearch.bulk` api.\n    "
    data = data.copy()
    op_type = data.pop('_op_type', 'index')
    action = {
        op_type: {
            
        },
    }
    for key in ('_index', '_parent', '_percolate', '_routing', '_timestamp', '_ttl', '_type', '_version', '_version_type', '_id', '_retry_on_conflict'):
        if (key in data):
            action[op_type][key] = data.pop(key)
    if (op_type == 'delete'):
        return (action, None)
    return (action, data.get('_source', data))

dataset/ETHPy150Open hvandenb/splunk-elasticsearch/search-elasticsearch/bin/elasticsearch/helpers/__init__.py expand_action/original