Created
November 13, 2018 09:59
-
-
Save diloabininyeri/9bf6ccee457439e45757fae94e039ca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "vendor/autoload.php"; | |
use Elasticsearch\ClientBuilder; | |
$client = ClientBuilder::create()->build(); | |
$res = $client->search([ | |
'index' => 'accounts', | |
'type' => 'person', | |
'body' => ["query" => [ | |
"multi_match" => [ | |
"query" => $_GET['q'], | |
"fields" => ["name^2", "lastname^1", "job_description^1"], | |
"slop" => 1, | |
"minimum_should_match" => 1 | |
] | |
] | |
] | |
]); | |
echo '<pre>'; | |
print_r($res['hits']['hits']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment