anchor.diff:              ok
       end.
   
  +
  +%% @doc
  +%% Function: add_failed/1
  +%% Purpose: Updates the polling history with a created datapoint message
  +%% Returns: ok or {error,{Code,Body}} if there was an error in ES
  +%% @end
  +-spec add_sucess(StreamId::string()) -> ok | {atom(),{integer(),string()}}.
  +
   add_sucess(StreamId) ->
   	Time = ?TIME_NOW(erlang:localtime()),
   	Message = lib_json:set_attrs([{"polling","{}"},{"polling.stream",list_to_binary(StreamId)},{"polling.message",list_to_binary("Created new datapoint")},{"polling.action",list_to_binary("create")},{"polling.timestamp",list_to_binary(Time)}]),
  
positive.code: 		{ok,_List} -> 
  			ok
  	end.
  
  add_failed(StreamId,connection_error) ->
  	Time = ?TIME_NOW(erlang:localtime()),
  
negative.code: 				parser = ParserString
  			   }.
  
  %% @doc
  %% Function: create_poller_history/1
  %% Purpose: creates an empty polling history for
  %%          the given stream
  %% Returns: ok or {Code,Body} if there was an error in ES
  %% @end
  -spec create_poller_history(StreamId::string()) -> ok | {integer(),string()}.
  
  create_poller_history(StreamId) ->
  	NewHistory = lib_json:set_attrs([{"history","[]"}]),
  	case erlastic_search:index_doc_with_id(?INDEX, "pollinghistory", StreamId, NewHistory) of	
  