jonbwhite / elkuent

Elasticsearch ORM for Laravel
7 stars 0 forks source link

Calling count() on a query builder fails #2

Closed jasonjlock closed 9 years ago

jasonjlock commented 9 years ago

Creating a new query builder, then calling count to get the total number of results is failing. screen shot 2015-03-25 at 11 31 48 am The count method on the builder calls aggregate() https://github.com/illuminate/database/blob/e6f05699841397f5dddd7c64509b78dd991207b1/Query/Builder.php#L1574 that expects an "aggreate" key to exsits in the returned results https://github.com/illuminate/database/blob/e6f05699841397f5dddd7c64509b78dd991207b1/Query/Builder.php#L1649. Since we haven't implemented aggregations it might be best to return the total number of results returned.

jonbwhite commented 9 years ago

Sounds like a good short term fix, we should hook in to elasticsearch aggregations as soon as possible: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html#search-aggregations