src/searchOld/elastic/Watch.php
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);
        }
    }
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);
        }
    }
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 ) ; } }
Flushes all elasticsearch indices for given model id

@param string $index
@param integer $modelId
Flushes all elasticsearch indices for given model id