Skip to content

Instantly share code, notes, and snippets.

@atakde
Created January 6, 2024 10:26
Show Gist options
  • Save atakde/2aa01dae09251ee502ef8c9f8d6efcec to your computer and use it in GitHub Desktop.
Save atakde/2aa01dae09251ee502ef8c9f8d6efcec to your computer and use it in GitHub Desktop.
Elastic Bool Query PHP
<?php
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text, public_linkedin_posts_new_poster_linkedin_url', // fields to return
'body' => [
'query' => [
'bool' => [
'must' => [
[ 'match' => [ 'public_linkedin_posts_new_text' => 'successful people' ] ],
[ 'match' => [ 'public_linkedin_posts_new_poster_linkedin_url' => 'alex' ] ],
]
]
]
]
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment