title: How to send JSON GET data with an HTTP request in C#
body: <p>So I am having a lot of trouble with how to send the below JSON data in C# format. I know exactly how to do it in cURL, but I can't figure this out for the life of me. This request is essential to what I am doing and I really need to get it done. Here is the curl statement:</p>
  
  <pre><code>   curl &lt;ip of server&gt;/&lt;index&gt;/_search?pretty=true -d '
   {
  "query": {
      "match_all": {}
  },
  "size": 1,
  "sort": [{
      "_timestamp": {
          "order": "desc"
      }
  }]
  }
  </code></pre>
  
  <p>If it helps at all I am making a request to an Elasticsearch server, and I am grabbing the JSON data. This cURL request gives me EXACTLY what I need. Here is the C# code that I have now, but I am not sure how to add this JSON data to the GET request. This is also gonna be running in the Unity game engine.</p>
  
  <pre><code>        // Create a request for the URL.        
          request = WebRequest.Create(elk_url);
          // If required by the server, set the credentials.
          request.Credentials = CredentialCache.DefaultCredentials;
          // Get the response.
  
          response = (HttpWebResponse)request.GetResponse();
          // Display the status.
          Debug.Log(response.StatusDescription);
          // Get the stream containing content returned by the server.
          dataStream = response.GetResponseStream();
          // Open the stream using a StreamReader for easy access.
          reader = new StreamReader(dataStream);
          // Read the content.
          string responseFromServer = reader.ReadToEnd();
          // Display the content.
          Debug.Log(responseFromServer);
          // Cleanup the streams and the response.
          reader.Close();
          dataStream.Close();
          response.Close();
  </code></pre>
  
  <p>The above is just from the documentation page, and I am pretty new to HTTP requests in code, so any help would be greatly appreciated. </p>