protected function flushForModel($index, $modelId)
    {
        $query = [
            'index' => $index,
            'body' => [
                'query' => [
                    'bool' => [
                        'filter' => [
                            'bool' => [
                                'must' => [
                                    'term' => ['model_id' => $modelId]
                                ]
                            ]
                        ],
                    ]
                ]
            ]
        ];
        $pks = IndexHelper::primaryKeysByCondition($this->client, $query);
        if (count($pks) > 0) {
            $params = ['body' => []];
            foreach ($pks as $id => $types) {
                foreach ($types as $type) {
                    $params['body'][] = [
                        'delete' => [
                            '_index' => $index,
                            '_type' => $type,
                            '_id' => $id
                        ]
                    ];
                }
            }
            $this->client->bulk($params);
        }
    }