Alan Flores
Alan Flores

Reputation: 35

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"
}

Upvotes: 1

Views: 437

Answers (0)

Related Questions