Why i get this illegal_argument_exception in Elasticsearch php search basic query?

I am using the Elasticsearch PHP package for execute queries. When I execute this basic search query, i get the illegal_argument_exception . The function elastic() returns the Client of Elasticsearch.

$query = $this->elastic()->search([
    'index' => ['my_index'],
    'type' => 'my_type',
    'from' => 0,
    'size' => 10,
    'body' => [
        'query' => [
            'match_all' => (object)[],
        ]
    ]
]);

Error:

{
    "type": "illegal_argument_exception",
    "reason": "field name is null or empty"
}

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