Skip to content

Instantly share code, notes, and snippets.

@vedovelli
Created September 23, 2016 12:03
Show Gist options
  • Save vedovelli/115541b97cd9790719c9cf52b4d43b37 to your computer and use it in GitHub Desktop.
Save vedovelli/115541b97cd9790719c9cf52b4d43b37 to your computer and use it in GitHub Desktop.
$hosts = ['http://octimine:[email protected]:9200'];
$client = \Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();
$parameters = [
'index' => 'startup',
'type' => 'profile',
'size' => 32,
'body' => [
'query' => [
'bool' => [
'must' => [
'match' => [
'full_description.english' => [
'query' => $inputText
]
]
],
'should' => [
'match' => [
'name' => [
'query' => [
'octimine'
],
'boost' => 0.1
]
]
]
]
]
]
];
if (count($tags) > 0) {
$parameters['body']['query']['bool']['filter']['term'] = ['tag_list' => $tags[0]];
}
$search = $client->search($parameters);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment