IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Get a document
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Get a document
editLet’s get the document that we just indexed. This will simply return the document:
$params = [
'index' => 'my_index',
'type' => 'my_type',
'id' => 'my_id'
];
$response = $client->get($params);
print_r($response);
The response contains some metadata (index, type, etc) as well as a _source field…this is the original document
that you sent to Elasticsearch.
Array
(
[_index] => my_index
[_type] => my_type
[_id] => my_id
[_version] => 1
[found] => 1
[_source] => Array
(
[testField] => abc
)
)