elasticsearch in magento 2 code example
Example: get elasticsearch data magento 2
<?php
//Make sure you have elasticsearch-php package installed before proceeding
use Elasticsearch\ClientBuilder;
require 'vendor/autoload.php';
$client = ClientBuilder::create()->build();
$params = [
'index' => 'my_index',
'id' => 'my_id'
];
$response = $client->get($params);
print_r($response);