title: Cannot send content-body with GET request
body: <p>I am trying to execute a simple "request body search" on Elasticsearch like the <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-body.html" rel="nofollow">following example</a> but using .NET instead of curl</p>
  
  <pre><code>$ curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
      "query" : {
          "term" : { "user" : "kimchy" }
      }
  }
  '
  </code></pre>
  
  <p>Below is my .NET code.</p>
  
  <pre><code>var uri = "http://localhost:9200/myindex/_search";
  var json = "{ \"query\" : { \"term\" : { \"user\" : \"kimchy\" } } }";
  
  var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
  request.ContentType = "text/json";
  request.Method = "GET";
  
  var responseString = string.Empty;
  
  using (var streamWriter = new System.IO.StreamWriter(request.GetRequestStream()))
  {
      streamWriter.Write(json);
      streamWriter.Flush();
      streamWriter.Close();
  
      var response = (System.Net.HttpWebResponse)request.GetResponse();
      using (var streamReader = new System.IO.StreamReader(response.GetResponseStream()))
      {
          responseString = streamReader.ReadToEnd();
      }
  }
  </code></pre>
  
  <p>However, I am getting the following error.</p>
  
  <pre><code>Cannot send a content-body with this verb-type.
  ...
  Exception Details: System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
  ...
  Line 54: using (var streamWriter = new System.IO.StreamWriter(request.GetRequestStream()))
  </code></pre>
  
  <p>Is there any way I can send a content-body with a <code>GET</code> request using standard .NET classes. Or is there a workaround?</p>