Skip to content

aggregations #22

Description

@yaofong

Hi everyone,

Can anyone show me how to get aggregations?

I tried to pass in 'aggs' into params but the response never return the aggregations

$params = [
            'query' => [
                'filtered' => [
                    'query' => $where
                ],
            ],
            'sort' => [
                ['id' => ['order' => 'desc']],
                ['rating' => ['order' => 'desc']],
                '_score'
            ],
            'highlight' => [
                'fields' => [
                    'title' => new \stdClass
                ]
            ],
            'aggs' => [
                'loc_meet_types' => [
                    'terms' => [
                        'field' => 'loc_meet_type'

                    ],
                ]
            ],
            'track_scores' => true
        ];

the response always the same no matter i add aggs or remove aggs 👍

array:7 [▼
  "per_page" => 20
  "current_page" => 1
  "next_page_url" => null
  "prev_page_url" => null
  "from" => 1
  "to" => 10
  "data" => array:10 [▼
    0 => array:40 [▶]
    1 => array:40 [▶]
    2 => array:40 [▶]
    3 => array:40 [▶]
    4 => array:40 [▶]
    5 => array:40 [▶]
    6 => array:40 [▶]
    7 => array:40 [▶]
    8 => array:40 [▶]
    9 => array:40 [▶]
  ]
]

p.s I'm using aws ElasticSearch with version 1.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions