message 'id cannot be null.'
$client = ClientBuilder::create()->build();
$params = [
'index' => 'layers'
'type' => 'layers_type'
'body' => [
'bool' => [
'should' => [
'multi_match' => [
'query' => ["304"],
'fields' => ["id"] // not a surrogate _id, by my own id, that is a part of my index properties
delete function requires an id since it is meant to delete a single document, that's the reason why you get that error.
In order to do what you want, you need the
deleteByQuery function instead, but it has been removed in 2.x and not added back (yet).