code: public function search($query) {
          if (is_array($query)) {
              if (array_key_exists("query", $query)) {
                  $dsl = new Stringify($query);
                  $q = (string) $dsl;
                  $url = $this->buildUrl(array(
                      $this->type, "_search?q=" . $q
                  ));
                  $result = json_decode($this->conn->get($url), true);
                  return $result;
              }
              throw new \ElasticSearch\Exception("Memcached protocol doesnt support the full DSL, only query");
          }
          elseif (is_string($query)) {
              /**
               * String based search means http query string search
               */
              $url = $this->buildUrl(array(
                  $this->type, "_search?q=" . $query
              ));
              $result = json_decode($this->conn->get($url), true);
              return $result;
          }
      }
docs: Search
  
  @return array
  @param array|string $query
  @throws \ElasticSearch\Exception