I'm busy checking out elasticsearch for a new project that I'm starting on. I'm currently running Symfony2.5, with the latest FOSElasticaBundle and all that. I'm doing some benchmarks into performance of the bundle (I know elastic in itself is pretty darn fast), but I've come across a small problem that may actually be easy to solve, if only the bundle's documentation were more verbose.
My actual question is simply how to, instead of returning an array of Doctrine objects (which I believe are populated via a DB query), to return a "raw" array of the response from Elastica itself? Including the response time, max score, etc. The docs for the FOSElasticaBundle are pretty vague on these topics...
It seems a bit counter-productive and slow to have to re-query the database when you already have all the information you're looking for from elastic? Or is there something very obvious that I'm missing here?
Thanks for any help!
Found the answer... Little bit of sleep can get a person a long way it seems.
If anybody else is trying to figure this out, after going through the whole hydrate: false
thing and what not (which is not related to this question in any way, by the way).
Simply use the service:
$this->get('fos_elastica.index.app.foo')->search($query)
to get the Elastica Type instance.
$this->get('fos_elastica.finder.app.foo')->find($query)
gets an array of Doctrine entities.
Hope this helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With