Skip to content

Instantly share code, notes, and snippets.

@atakde
Created January 6, 2024 10:10
Show Gist options
  • Save atakde/444dfaf23bc0876227d169a77b098771 to your computer and use it in GitHub Desktop.
Save atakde/444dfaf23bc0876227d169a77b098771 to your computer and use it in GitHub Desktop.
Medium Elastic Example
<?php
require 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
use Atakan\ElasticEx\MySearchEngine;
$searchEngine = new MySearchEngine();
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text', // fields to return
'body' => [
'query' => [
'match' => [
'public_linkedin_posts_new_text' => 'Successful People' // search
]
]
]
]
);
$results = $searchResults->asArray();
var_dump($results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment