int(1)
string(1) "3"
array(3) {
["key"]=>
string(8) "19314771"
["doc_count"]=>
int(2)
["end_battle"]=>
array(3) {
["doc_count_error_upper_bound"]=>
int(0)
["sum_other_doc_count"]=>
int(0)
["buckets"]=>
array(2) {
[0]=>
array(2) {
["key"]=>
string(2) "2
"
["doc_count"]=>
int(1)
}
[1]=>
array(2) {
["key"]=>
string(2) "3
"
["doc_count"]=>
int(1)
}
}
}
}
int(1)
string(1) "3"
array(3) {
["key"]=>
string(8) "19059941"
["doc_count"]=>
int(1)
["end_battle"]=>
array(3) {
["doc_count_error_upper_bound"]=>
int(0)
["sum_other_doc_count"]=>
int(0)
["buckets"]=>
array(1) {
[0]=>
array(2) {
["key"]=>
string(2) "2
"
["doc_count"]=>
int(1)
}
}
}
}
int(0)
string(1) "2"
array(3) {
["key"]=>
string(8) "19213271"
["doc_count"]=>
int(1)
["end_battle"]=>
array(3) {
["doc_count_error_upper_bound"]=>
int(0)
["sum_other_doc_count"]=>
int(0)
["buckets"]=>
array(1) {
[0]=>
array(2) {
["key"]=>
string(2) "2
"
["doc_count"]=>
int(1)
}
}
}
}
int(0)
string(1) "2"
array(3) {
["key"]=>
string(8) "19225631"
["doc_count"]=>
int(1)
["end_battle"]=>
array(3) {
["doc_count_error_upper_bound"]=>
int(0)
["sum_other_doc_count"]=>
int(0)
["buckets"]=>
array(1) {
[0]=>
array(2) {
["key"]=>
string(2) "2
"
["doc_count"]=>
int(1)
}
}
}
}
foreach($response['aggregations']['days']['buckets'] as $v){
$c = count($v['end_battle']['buckets'])-1;
$b = trim($v['end_battle']['buckets'][$c]["key"]);
$r[$b] = array_key_exists($b,$r) ? (int)$r[$b]+1 : 1;
}
exit;
reset($r);
foreach($r as $key=>$val){
$res['time'] = date("Y-m-d",$item['stime']);
$res['match'] = $key;
$res['num'] = $val;
$tmp[]=$res;
}
array(2) {
[0]=>
array(3) {
["time"]=>
string(10) "2020-01-11"
["match"]=>
int(3)
["num"]=>
int(7)
}
[1]=>
array(3) {
["time"]=>
string(10) "2020-01-11"
["match"]=>
int(2)
["num"]=>
int(5)
}
}
$b = $v['end_battle']['buckets'][$c];
var_dump($b);
array(2) {
["key"]=>
string(2) "3
"
["doc_count"]=>
int(1)
}