anchor.diff:  update_resource(Resource, ResourceId) ->
   	erlang:display("-2-2-2-2-2-2-2"),
   	erlang:display(ResourceId),
  -	Manufacturer = binary_undefined_to_string(lib_json:get_field(Resource, "manufacturer")),
  -	Model = binary_undefined_to_string(lib_json:get_field(Resource, "model")),
  -	Tags = binary_undefined_to_string(lib_json:get_field(Resource, "tags")),
  -	Polling_freq = binary_undefined_to_string(lib_json:get_field(Resource, "polling_freq")),
  +	Manufacturer = lib_json:get_field(Resource, "manufacturer"),
  +	Model = lib_json:get_field(Resource, "model"),
  +	Tags = lib_json:get_field(Resource, "tags"),
  +	Polling_freq = lib_json:get_field(Resource, "polling_freq"),
   	RId = list_to_binary(ResourceId),
   	erlang:display("-1-1-1-1-1-1-1"),
   	%fetch old suggestion
  
positive.code: 		undefined ->
  			{error, no_model};
  		_ ->
  			Suggestion = "{
  				\"resource_id\" : \"" ++ undefined_to_string(ResourceId) ++ "\",
  				\"suggest\" : {
  					\"input\" : [ \"" ++ undefined_to_string(Model) ++ "\" ], 
  					\"output\" : \"" ++ get_timestamp() ++ "\",
  					\"payload\" : { 
  						\"manufacturer\" : \"" ++ undefined_to_string(Manufacturer) ++ "\",
  						\"tags\" : \"" ++ undefined_to_string(Tags) ++ "\",
  						\"polling_freq\" : \"" ++ undefined_to_string(Polling_freq) ++ "\"
  					},
  					\"weight\" : " ++ integer_to_list(Weight) ++ "
  				}				
  				}",
  			case erlastic_search:index_doc(?INDEX, "suggestion", Suggestion) of 
  				{error, _Reason} -> erlang:display("Suggestion not saved ");
  				{ok, _} -> 	ok
  
negative.code: 	TS = {_MSec,_Sec,Micro} = os:timestamp(),
  	{{Year,Month,Day},{Hour,Minute,Second}} = calendar:now_to_universal_time(TS),
  	Mstr = element(Month,{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}),
  	binary:list_to_bin(io_lib:format("~2w ~s ~4w ~2w:~2..0w:~2..0w.~6..0w", [Day,Mstr,Year,Hour,Minute,Second,Micro])).
  
  
  
  
  