Repository navigation
Aggregation sum of field #137
Unanswered
budgetcontrol-app
asked this question in
Q&A
Replies: 1 comment
|
I can't tell you without the data. Try to reproduce it in the demo app: https://github.com/Jeroen-G/explorer-demo Until then I'm assuming this is nog an issue, but a question. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
use JeroenG\Explorer\Domain\Syntax\Compound\BoolQuery;
use JeroenG\Explorer\Domain\Syntax\Matching;
use JeroenG\Explorer\Domain\Syntax\Nested;
use JeroenG\Explorer\Domain\Syntax\Terms;
use JeroenG\Explorer\Domain\Syntax\Term;
use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
use JeroenG\Explorer\Application\Results;
use JeroenG\Explorer\Domain\Aggregations\TermsAggregation;
$exitems = Exitem::search()
->filter(new Term('user_id', Auth::user()->id))->filter(new Term('tag_id', $request->input('tag_id')));
$exitems = $exitems->aggregation('sum', new TermsAggregation('item_sum'));
return response()->json($exitems);
it returns
{
"model": [],
"query": "",
"callback": null,
"queryCallback": null,
"index": null,
"wheres": [],
"whereIns": [],
"limit": null,
"orders": [],
"filter": [
{},
{}
],
"aggregations": {
"sum": {}
}
}
without aggregation sum field ....
how to get sum for some field
All reactions