Delete by query not working even data exists on index

I’m using delete by query in the PHP client for elasticsearch. I have elasticsearch index posts with some parent-child relations. So when I try to delete some records from child relation the query executes successfully and shows success but records are not deleted from the index, and most of the time query work properly. But this issue produced some time.

Query

$query = [
            'index' => 'posts',
            'body' => [
                'query' => [
                    'bool' => [
                        'should' => [
                            [
                                "bool" => [
                                    "must" => [
                                        ['term' => ['type' => 'box_post']],
                                        ['term' => ['post_id' => (int) $post_id]]
                                    ]
                                ]
                            ],
                            [
                                "bool" => [
                                    "must" => [
                                        ['term' => ['type' => 'post_box']],
                                        ['term' => ['post_id' => (int) $post_id]]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ];
 $this->client->deleteByQuery($query)

Response

Array
(
    [took] => 0
    [timed_out] => 
    [total] => 0
    [deleted] => 0
    [batches] => 0
    [version_conflicts] => 0
    [noops] => 0
    [retries] => Array
        (
            [bulk] => 0
            [search] => 0
        )

    [throttled_millis] => 0
    [requests_per_second] => -1
    [throttled_until_millis] => 0
    [failures] => Array
        (
        )
)

Is there any way to make sure that if the record exists on the index then the query must delete the record instead of showing the success message with no record deleted?