Changed elasticsearch 'create' to 'index' so that the function will work for both create and updates