title: elasticsearch aggregation PHP
body: <p>i am trying to get the unique values from my elasticsearch database.</p>
  
  <p>So i want the unique names from my elasticsearch database.</p>
  
  <p>So i am aggregation like so ---              </p>
  
  <pre><code>   $paramss = [
              'index' =&gt; 'myIndex',
              'type' =&gt; 'myType',
              'ignore_unavailable' =&gt; true,
              'ignore' =&gt; [404, 500]
          ];
  
  
      $paramss['body'] = &lt;&lt;&lt;JSON
  {
  "size": 0,
  "aggs" : {
      "langs" : {
          "terms" : { "field" : "name" }
      }
  }}
  JSON;
  
          $results = $client-&gt;search($paramss);
          print_r(json_encode($results));
  </code></pre>
  
  <p>i get the result like so---</p>
  
  <pre><code>{
  took: 3,
  timed_out: false,
  _shards: {
      total: 5,
      successful: 5,
      failed: 0
  },
  hits: {
      total: 1852,
      max_score: 0,
      hits: [
  
      ]
  },
  aggregations: {
      langs: {
          buckets: [
              {
                  key: "aaaa.se",
                  doc_count: 430
              },
              {
                  key: "bbbb.se",
                  doc_count: 358
              },
              {
                  key: "cccc.se",
                  doc_count: 49
              },
              {
                  key: "eeee.com",
                  doc_count: 46
              }
          ]
      }
  }
  }
  </code></pre>
  
  <p>But the problem is i am not getting all the unique values, I am getting only <strong>10 values</strong>, which is default value for elasticsearch query.</p>
  
  <p>So how can i change the query size !!!</p>
  
  <p>i tried like so---</p>
  
  <pre><code>   $paramss = [
              'index' =&gt; 'myIndex',
              'type' =&gt; 'myType',
              'size' =&gt; 1000,
              'ignore_unavailable' =&gt; true,
              'ignore' =&gt; [404, 500]
          ];
  </code></pre>
  
  <p>which returns me some weird documents.</p>
  
  <p>So do anyone knows the solution of this problem.</p>
  
  <p>How can i get all the unique names from my elasticsearch database, can someone help me to fix this problem. </p>