title: Different result with Java TransportClient than REST/CURL
body: <p>I have written a whole query with aggregations and such which gives me exactly what I want when I use REST and call with CURL and do a POST:</p>
  
  <pre><code>POST http://127.0.0.1:9200/user_index/account_record/_search?search_type=count
  {
     "aggs":{
        "updates_by_user":{
           "terms":{
              "script":"doc['accountNumber'].value"
           }
        }
     }
  }
  </code></pre>
  
  <p>I want to use this same JSON and get the same result back from the Java API.   Instead the Java API behaves as if I have done a HTTP GET operation.   Is there a way to easily reuse the same JSON through the Java API?   It looks from the Javadoc like one must break this up into pieces with numerous methods like .addAggregation.   I just get a high level count back and no detail on buckets</p>
  
  <p>For the record, my JSON is a lot more complicated, I am just simplifying for sake of the question.</p>
  
  <p>My Java code looks like</p>
  
  <pre><code>SearchResponse searchResponse = client.prepareSearch("user_index")
                  .setTypes("account_record")
                  .setSearchType(SearchType.QUERY_THEN_FETCH)
                  .setSize(0)
                  .setQuery(query)
                  .execute().actionGet();
  </code></pre>
  
  <p>Any ideas?   I guess I can always use HTTP Client but would rather not pull in another library/syntax unless it is necessary.</p>
  
  <p>Thanks for any ideas.</p>