in functions/streaming/updateSearchCluster.py [0:0]
def handler(event, context):
count = 0
for record in event["Records"]:
# Get the primary key for use as the Elasticsearch ID
id = record["dynamodb"]["Keys"]["id"]["S"]
print "bookId " + id
if record['eventName'] == 'REMOVE':
r = requests.delete(url + id, auth=awsauth)
else:
document = record['dynamodb']['NewImage']
r = requests.put(url + id, auth=awsauth, json=document, headers=headers)
count += 1
return str(count) + " records processed."