Open ametad opened 4 years ago
Hello Basem Khirat,
Your package helped me out a great deal, thank you! I like to use some extra data retrieved from Elasticsearch, some already included (but not all):
\Basemkhirat\Elasticsearch\Query
$new->total = $result["hits"]["total"]; $new->max_score = $result["hits"]["max_score"]; $new->took = $result["took"]; $new->timed_out = $result["timed_out"]; // typical Elasticsearch data $new->scroll_id = isset($result["_scroll_id"]) ? $result["_scroll_id"] : NULL; // typical Elasticsearch data $new->shards = (object)$result["_shards"]; // typical Elasticsearch data
I would like to add this data so I can use this in my application:
$new->aggregations = isset($result['aggregations']) ? (object) $result['aggregations'] : NULL;
Nothing further has to be changed in you package, but with this change aggregations can be retrieved as follows:
$rules = [ 'query' => [ // ... ], 'aggs' => [ // ... ], ]; $result = MyModel::body($rules)->paginate(); $result->getCollection()->aggregations;
@basemkhirat The tests fail also without my additions to the code base. I hope the tests failing is not a problem for you accepting my PR?
Hello Basem Khirat,
Your package helped me out a great deal, thank you! I like to use some extra data retrieved from Elasticsearch, some already included (but not all):
\Basemkhirat\Elasticsearch\Query
I would like to add this data so I can use this in my application:
Nothing further has to be changed in you package, but with this change aggregations can be retrieved as follows: