title: Elasticsearch PHP Client Error - 500 unable to handle this request
body: <p>I was doing what <a href="https://www.youtube.com/watch?v=3xb1dHLg-Lk" rel="nofollow noreferrer">this tutorial said</a>. Basically I have added Elasticsearch PHP client using Composer. My Elasticsearch is running on Docker on localhost:32773.</p>
  <p>This is my index.php code. What I want to do is search through my documents in Elasticsearch and display just like in this tutorial.</p>
  <pre><code>&lt;?php
  use Elasticsearch\ClientBuilder;
  require 'vendor/autoload.php';
  
  $hosts = [
        // Just Domain
      'http://192.168.1.101:32773',
      'http://127.0.0.1:32773'  // SSL to IP + Port
  ];
  $clientBuilder = ClientBuilder::create();   // Instantiate a new ClientBuilder
  $clientBuilder-&gt;setHosts($hosts);           // Set the hosts
  $client = $clientBuilder-&gt;build(); 
  if(isset($_GET['q'])) {
      $q=$_GET['q'];
      $query=$es-&gt;search([
          'result'=&gt; [
              'query'=&gt;[
              'bool' =&gt; [
              'should' =&gt; [
              'match' =&gt; ['year' =&gt; $q]],
              'match' =&gt; ['body' =&gt; $q]
              ]
              ]
              ]
          ]);
      echo'&lt;pre&gt;',print_r($results),'&lt;/pre&gt;';
      if($query['hits'] ['total'] &gt;=1) {
          $results=$query['hits'] ['hits'];
      }
  }
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;title&gt; Search | ES&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;css/main.css&quot;&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form action=&quot;index.php&quot; method=&quot;get&quot; autocomplete=&quot;off&quot;&gt;
      &lt;label&gt;
          Search for something
          &lt;input type=&quot;text&quot; name=&quot;q&quot;&gt;
      &lt;/label&gt;
      &lt;input type=&quot;submit&quot; value=&quot;Search&quot;&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I am not getting any output. When I press search it says</p>
  <blockquote>
  <p>The localhost page isn’t working</p>
  <p>localhost is currently unable to handle this request.</p>
  <p>HTTP ERROR 500</p>
  </blockquote>