Elastica
Elastica copied to clipboard
How to create suggest query with source filtering?
Hello!
I'd like to create query like this:
{
"_source": "suggest",
"suggest": {
"some-suggest" : {
"prefix": "som",
"completion" : {
"field" : "suggest",
"size" : 5
}
}
}
}
Im having troubles with setting _source
parameter...
So far I have this -
$suggest = new Suggest();
$term = new Suggest\Completion('some-suggest', 'suggest');
$term->setSize(5);
$suggest->addSuggestion($term);
$index = $this->indexFactory->get($domain, $type);
$resultSet = $index->search($suggest);
Calling $index->search($suggest, ['_source' => ['param', 'param']]);
did not pass validation rules...
Am I missing something?
What are you exactly trying to set with the _source -> param ...
you have mentioned last? What do you get if you run $suggest->toArray()
and print the output?