I am trying to lookup a mongodb document based on its _id in elasticsearch using php-2.0 api of elasticsearch. It is giving me error
[2016-03-22 01:38:34,672][DEBUG][action.search.type ] [Cameron Hodge] [smartjn][1], node[rMZbhVr7R-ezCeg2DeirLQ], [P], v[4], s[STARTED], a[id=q1AbfdiHTN6RqA2p_DTw8g]: Failed to execute [org.elasticsearch.action.search.SearchRequest@55c6bb7d] lastShard [true]
RemoteTransportException[[Cameron Hodge][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"query":{"match":{"uid":{}}}}]]; nested: QueryParsingException[No text specified for text query];
Caused by: SearchParseException[failed to parse search source [{"query":{"match":{"uid":{}}}}]]; nested: QueryParsingException[No text specified for text query];
The code is
require 'vendor/autoload.php';
$userId = new MongoDB\BSON\ObjectId($userID);
$client2 = Elasticsearch\ClientBuilder::create()->build();
$params = [
'index' => 'smartjn',
'type' => 'user_master',
'body' => [
'query' => [
'match' => ['_id' => $userId]
]
]
];
$results2 = $client2->search($params);
Any pointers on what am I doing wrong?
Thanks