I'm trying to use Elasticsearch with a PHP client. However, when I construct a simple query, it gives drastically different results against the same index than what I believe is the equivalent query via Curl or Python. I.e., the results are entirely unrelated to the query - seems like a random chunk of data. It also returns these same results regardless of the value of the parameter (last name) I send. Here is the PHP code:
<?php require 'vendor/autoload.php'; use Elasticsearch\ClientBuilder; $client = ClientBuilder::create()->build(); $params = [ 'index' => 'directory', 'body' => [ 'query' => [ 'match' => [ 'last_name' => 'ely' ] ] ] ]; $response = @$client->search($params); print_r($response); ?>
And here is the Curl equivalent, that returns accurate results:
Thanks in advance for any suggestions!