How to check if results are empty in SearchHitIterator in php

I am using a SearchHitIterator in php like this

$params = [
                'index' => 'empire',
                'body' => [
                    'query' => [
                        'match' => [
                            "entity.$field" => [
                                'query' => $query,
                                'analyzer' => 'my_analyzer'
                            ]
                        ]
                    ]
                ]
            ];
            $pages = new SearchResponseIterator($this->client, $params);
            $hits = new SearchHitIterator($pages);

Is there a method to check if results are empty?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.