Unable to find document on _id in elasticsearch mongodb

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

I don't know PHP, but it doesn't look like your ID is being passed in.

Hi @warkolm , sorry I pasted an old log , the recent one is

[2016-03-22 03:32:33,483][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@2b7ced36] 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":{"_id":{}}}}]]; nested: QueryParsingException[No text specified for text query];
Caused by: SearchParseException[failed to parse search source [{"query":{"match":{"_id":{}}}}]]; nested: QueryParsingException[No text specified for text query];

Thanks

It's still the same error.

Yes the error is same, and I am trying to understand the error behind it , and how to rectify it.

Thanks

Like I said, your ID isn't being passed to ES in the query, so I'd start by making sure your code does that.

silly mistake from my side , just passed the id as String without converting it to BSON object.

Thank you all.