title: Elasticsearch-PHP 7 Return All documents of a given mapping
body: <h2>Summary</h2>
  <p>Failing to get any/all documents from my ElasticSearch instance using the ElasticSearch-PHP 7 package.</p>
  <p>When I run Curl query, works just fine. So I know I have bulk inserted the documents properly. Meaning that documents do exist.</p>
  <h2>Curl Success</h2>
  <p><strong>Curl Call</strong></p>
  <pre><code>curl -X GET -u elastic:changeme 'ltr-elasticsearch:9200/experiences_1621701804/region/_search?pretty'
  </code></pre>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;took&quot;: 58,
      &quot;timed_out&quot;: false,
      &quot;_shards&quot;: {
          &quot;total&quot;: 5,
          &quot;successful&quot;: 5,
          &quot;skipped&quot;: 0,
          &quot;failed&quot;: 0
      },
      &quot;hits&quot;: {
          &quot;total&quot;: 100,
          &quot;max_score&quot;: 1,
          &quot;hits&quot;: [
              {
                  &quot;_index&quot;: &quot;experiences_1621701804&quot;,
                  &quot;_type&quot;: &quot;region&quot;,
                  &quot;_id&quot;: &quot;14&quot;,
                  &quot;_score&quot;: 1,
                  &quot;_source&quot;: {
                      &quot;id&quot;: 14,
                      &quot;name&quot;: &quot;Dallas&quot;,
                      &quot;active&quot;: &quot;1&quot;,
                      &quot;image&quot;: {
                          &quot;domain&quot;: null,
                          &quot;original&quot;: &quot;https://d2l34t1fl9ccx8.cloudfront.net/media/image/d/a/dallas.jpg&quot;,
                          &quot;small&quot;: &quot;https://d2l34t1fl9ccx8.cloudfront.net/media/image/d/a/dallas.jpg&quot;,
                          &quot;thumbnail&quot;: &quot;https://d2l34t1fl9ccx8.cloudfront.net/media/image/d/a/dallas.jpg&quot;
                      }
                  }
              }
              // many more document results show up here
          ]
      }
  };
  </code></pre>
  <h2>Elasticsearch-PHP 7 Search Manual</h2>
  <p><a href="https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/search_operations.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/search_operations.html</a></p>
  <pre class="lang-php prettyprint-override"><code>// Build Params with Raw JSON
  $params = [
      'index' =&gt; 'experiences_1621701804',
      'type' =&gt; 'region',
      'body'  =&gt; '{
          &quot;query&quot;: {
              &quot;match_all&quot;: {}
          }
      }',
  ];
  
  // Also tried
  $params = [
      'index' =&gt; 'experiences_1621701804',
      'type' =&gt; 'region',
      'body'   =&gt; [
          'query' =&gt; [
              'match_all' =&gt; new \stdClass()
          ]
      ]
  ];
  
  // Trigger Search
  $results = $esClientBuilder-&gt;search($params);
  print_r($results);
  </code></pre>
  <h2>Results Dumped Fails To Show Results</h2>
  <pre class="lang-sh prettyprint-override"><code>(
      [took] =&gt; 0
      [timed_out] =&gt;
      [_shards] =&gt; Array
          (
              [total] =&gt; 5
              [successful] =&gt; 5
              [skipped] =&gt; 0
              [failed] =&gt; 0
          )
  
      [hits] =&gt; Array
          (
              [total] =&gt; 0
              [max_score] =&gt;
              [hits] =&gt; Array
                  (
                  )
  
          )
  )
  </code></pre>
  <h1>Updated Possible Solution?</h1>
  <p>Rookie move, I should have compared versions. There is a version mapping for the package elasticsearch/elasticsearch.</p>
  <p><a href="https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/installation.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/installation.html</a></p>
  <p>I am currently on v 5.2 of elasticsearch/elasticsearch.</p>
  <p>It looks like v5 does not support match_all? Which to me is really odd. I would think a fundamental feature would be to get ALL documents. I get it's a search tool, and maybe it just focused on filtered search results. And it's possible it just handles it in a different way undocumented.</p>
  <p>v5: <a href="https://www.elastic.co/guide/en/elasticsearch/client/php-api/5.x/_match_query.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/php-api/5.x/_match_query.html</a></p>
  <p>I am currently locked out of my work VPN  and unable to upgrade packages to test. Will follow up once I am able.</p>