title: How to query Elasticsearch from C# via HTTP?
body: <p>I am trying to write code in C# for PUT and GET to my elasticsearch data.
  I typed code for PUT like this, and it seems that it works:</p>
  
  <pre><code>string url = "http://localhost:9200/my_index/my_type/";
  
  JsonDocFormat json = new JsonDocFormat()
  {
     name = "John"
  };
  
  string s = JsonConvert.SerializeObject(json);
  
  using (var client = new WebClient())
  {
     client.UploadString(url, "POST", s);
  }
  </code></pre>
  
  <p>But I can't write code for this GET:</p>
  
  <pre><code>GET my_index/my_type/_search
  {
     "query" : {
         "match" : {
              "name" : "john"
          }
      }
  }
  </code></pre>
  
  <p>I tried something like this:</p>
  
  <pre><code>string url_req = "http://localhost:9200/my_index/my_type/_search?pretty";
  
  string s1 = "{\"query\": {\"match\": { \"name\" : \"john\" }}}";
  
  string s_req = url_req + s1;
  
  using (var client = new WebClient())
  {
      Console.Write(client.DownloadString(s_req));
  }
  </code></pre>
  
  <p>But this code returned same output as for this GET:</p>
  
  <pre><code>GET /my_index/my_type/_search
  </code></pre>
  
  <p>It did not throw any error, but it absolutely ignored json body at the end of URL. I want to write this without any external package (as NEST or Elasticsearch.NET), just with HTTP.</p>
  
  <p>Thanks in advance for any help!</p>