 			query.onError error)
 
 
+# Add events to ElasticSearch event index
+# @param [object] query
+# @option query [object] group
+# @option query [function] onSuccess
+# @option query [function] onError
 setGroup = (query) ->
-	client.create
+	client.index
 		'index': 'groups',
 		'type': 'group'
+		'id': query.group.id
 		'body': query.group
 	.then(
 		(result) ->

			if not exists
				client.indices.create
					'index': name
				.then(
					(body) ->
						console.log "Created #{name} index successfully"
					(error) ->
						console.error 'Failed to create event index')
			else
				console.log "Index already exists"
	
		(error) ->
			console.error error)
  

# Make sure elastic search is running
client.ping

			query.onError error)


# Export set and setGroup functions
exports = module.exports =
	'set': set
	'setGroup': setGroup
