Closed wangyongdong closed 5 months ago
I'm sorry but we can provide support only in English. Can you translate your request? Thanks!
I'm sorry but we can provide support only in English. Can you translate your request? Thanks!
Sorry, I have translated it into English
@wangyongdong the $response
is an object of Elastic\Elasticsearch\Response\Elasticsearch
that is compatible with PSR-7 regarding the HTTP response and it offers also the body content.
Here you can find more information about the response object.
The body content is stored inside the same object and you can take it as object property or using an array index interface. For instance, to get a document you can use the following code:
$params = [
'index' => 'my_index',
'id' => 'my_id',
];
$response = $client->get($params);
var_dump($response['_source']); // get the document using array interface
var_dump($response->_source); // get the document as object property
@wangyongdong the
$response
is an object ofElastic\Elasticsearch\Response\Elasticsearch
that is compatible with PSR-7 regarding the HTTP response and it offers also the body content.Here you can find more information about the response object.
The body content is stored inside the same object and you can take it as object property or using an array index interface. For instance, to get a document you can use the following code:
$params = [ 'index' => 'my_index', 'id' => 'my_id', ]; $response = $client->get($params); var_dump($response['_source']); // get the document using array interface var_dump($response->_source); // get the document as object property
Thank you
Using the PHP GET method, you cannot get the content of the documentation
Code, return information, configuration file
1、Create an index document
Return result:
2、Get the document:
Return result:
I can't see the content of the document in the return result. Use the
CURL -X GET" http://192.168.xxx.xxx:9200/my_index/_doc/my_id?pretty "
, the return results are as follows as follows:Why can you create documents through PHP and cannot get the content of the document?
/etc/elasticsearch/elasticsearch.yml
The content of the file is as follows:System details