anchor.diff:      Id = id_from_path(ReqData),
   	{UserJson,_,_} = api_help:json_handler(ReqData, State),
       %check if doc already exists
  -	case api_help:do_only_fields_exist(UserJson,?ACCEPTEDFIELDSUSERS) of
  -		false ->
  +	case {api_help:do_any_field_exist(UserJson,?RESTRCITEDUPDATEUSERS),api_help:do_only_fields_exist(UserJson,?ACCEPTEDFIELDSUSERS)} of
  +		{true,_} ->
  +			ResFields1 = lists:foldl(fun(X, Acc) -> X ++ ", " ++ Acc end, "", ?RESTRCITEDUPDATEUSERS),
  +			ResFields2 = string:sub_string(ResFields1, 1, length(ResFields1)-2),
  +			{{halt,409}, wrq:set_resp_body("{\"error\":\"Error caused by restricted field in document, these fields are restricted : " ++ ResFields2 ++"\"}", ReqData), State};
  +		{false,false} ->
   			{{halt,403}, wrq:set_resp_body("Unsupported field(s)", ReqData), State};
  -		true ->
  -			case erlastic_search:get_doc(?INDEX, "user", Id) of
  +		{false,true} ->
  +			Query = "{\"size\" :100,\"query\" : {\"term\" : {\"username\":\"" ++ Id ++"\"}}}",
  +			case erlastic_search:search_json(#erls_params{},?INDEX, "user", Query) of
   				{error, {Code, Body}} -> 
   					ErrorString = api_help:generate_error(Body, Code),
   					{{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
   				{ok, List} ->
  -            		case erlastic_search:index_doc_with_id(?INDEX, "user", Id, UserJson) of
  -                		{error, {Code, Body}} -> 
  -                    		ErrorString = api_help:generate_error(Body, Code),
  -                    		{{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  -                		{ok, Json} ->
  -		            		{true, wrq:set_resp_body(lib_json:encode(Json), ReqData), State}
  -            		end
  +					ESId = lib_json:to_string(lib_json:get_field(List, "hits.hits[0]._id")),
  +					Update = api_help:create_update(UserJson),
  +					case api_help:update_doc(?INDEX, "user", ESId, Update) of
  +						{error, {Code, Body}} -> 
  +							ErrorString = api_help:generate_error(Body, Code),
  +							{{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  +						{ok, Json} ->
  +							{true, wrq:set_resp_body(lib_json:encode(Json), ReqData), State}
  +					end
  +							
       		end
   	end.
   
  
positive.code:                         SizeParam ->
                              Size = list_to_integer(SizeParam)
                      end,
  					
  					Query = "{\"size\" :" ++ integer_to_list(Size) ++",\"query\" : {\"match_all\" : {}},\"filter\" : {\"bool\":{\"must_not\":{\"term\":{\"private\":\"true\"}}}}}",
  					case erlastic_search:search_json(#erls_params{},?INDEX, "user", Query) of
                          {error, {Code, Body}} -> 
  
negative.code:                     end;
                  Id ->
  				    %% Get specific user
  					Query = "{\"size\" :100,\"query\" : {\"term\" : {\"username\":\"" ++ Id ++"\"}}}",
  					case erlastic_search:search_json(#erls_params{},?INDEX, "user", Query) of 
  						{error, {Code, Body}} -> 
  							ErrorString = api_help:generate_error(Body, Code),
                              {{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  						{ok, Json} ->
  							ESId = lib_json:get_field(Json, "hits.hits[0]._id"),
  							case erlastic_search:get_doc(?INDEX, "user", ESId) of
  								{error, {Code1, Body1}} -> 
  									ErrorString1 = api_help:generate_error(Body1, Code1),
  									{{halt, Code1}, wrq:set_resp_body(ErrorString1, ReqData), State};
  								{ok,JsonStruct} ->
  									FinalJson = lib_json:get_and_add_id(JsonStruct),
  									{FinalJson, ReqData, State} 
  							end
  					end
              end;
          true ->                        
              process_search(ReqData,State, get)                        
  