anchor.diff:  
   -include_lib("webmachine/include/webmachine.hrl").
   -include("include/user.hrl").
  +
  +-define(INDEX, "sensorcloud").
   
   %% @doc
   %% Function: init/1
  
positive.code: 
  
  %% DELETE
  delete_resource(ReqData, State) ->
          erlastic_search_app:start_deps(),
  	Id = proplists:get_value('stream', wrq:path_info(ReqData)),
  	erlang:display("delete request"),
  	erlastic_search:delete_doc("streams","stream", integer_to_list(Id)),
  	{true, ReqData, State}.
  
  
  %% POST
  
negative.code: 	case proplists:get_value('stream', wrq:path_info(ReqData)) of
  		undefined ->
  		% List streams based on URI
  		    erlang:display("Value undefined"),
  			case proplists:get_value('user', wrq:path_info(ReqData)) of
  				undefined ->
  					UserQuery = [],
  					UserDef = false;
  				UserId ->
  					UserQuery = "owner_id:" ++ UserId,
  					UserDef = true
  			end,
  			case proplists:get_value('res', wrq:path_info(ReqData)) of
  				undefined ->
  					ResQuery = [],
  					ResDef = false;
  				ResId ->
  					ResQuery = "resource_id:" ++ ResId,
  					ResDef = true
  			end,
  			case ResDef and UserDef of
  				true -> Query = ResQuery;
  				false -> case ResDef or UserDef of
  							 true -> Query = UserQuery ++ ResQuery;
  							 false -> Query = "*"
  						 end
  			end,
  			case erlastic_search:search_limit(?INDEX, "stream", Query, 10) of % Maybe wanna take more
  				{error,Reason} -> {{error, Reason}, ReqData, State};
  				{ok,List} -> {json_encode(List), ReqData, State} % Maybe need to convert
  			end;
  		StreamId ->
  		        erlang:display("Value defined"),
  		% Get specific stream
  			case erlastic_search:get_doc(?INDEX, "stream", StreamId) of 
  				{error, Msg} -> 
  						erlang:display("got error"),
  						{Msg, ReqData, State};
  				{ok,List} -> 
  						 erlang:display("got value"),
  					     {json_encode(List), ReqData, State}
  			end
  	end.
  
  