src/Classes/Bulk.php
public function action($actionType, $data = [])
    {

        $this->body["body"][] = [

            $actionType => [
                '_index' => $this->getIndex(),
                '_type' => $this->getType(),
                '_id' => $this->_id
            ]

        ];

        if (!empty($data)) {
            if($actionType == "update"){
                $this->body["body"][] = ["doc" => $data];
            }else {
                $this->body["body"][] = $data;
            }
        }

        $this->operationCount++;

        $this->reset();

        if ($this->autocommitAfter > 0 && $this->operationCount >= $this->autocommitAfter) {
            return $this->commit();
        }

        return true;
    }
public function action($actionType, $data = [])
    {

        $this->body["body"][] = [

            $actionType => [
                '_index' => $this->getIndex(),
                '_type' => $this->getType(),
                '_id' => $this->_id
            ]

        ];

        if (!empty($data)) {
            if($actionType == "update"){
                $this->body["body"][] = ["doc" => $data];
            }else {
                $this->body["body"][] = $data;
            }
        }

        $this->operationCount++;

        $this->reset();

        if ($this->autocommitAfter > 0 && $this->operationCount >= $this->autocommitAfter) {
            return $this->commit();
        }

        return true;
    }
public function action ( $ actionType , $ data = [ ] ) { $ this -> body [ "body" ] [ ] = [ $ actionType => [ '_index' => $ this -> getIndex ( ) , '_type' => $ this -> getType ( ) , '_id' => $ this -> _id ] ] ; if ( ! empty ( $ data ) ) { if ( $ actionType == "update" ) { $ this -> body [ "body" ] [ ] = [ "doc" => $ data ] ; } else { $ this -> body [ "body" ] [ ] = $ data ; } } $ this -> operationCount ++ ; $ this -> reset ( ) ; if ( $ this -> autocommitAfter > 0 && $ this -> operationCount >= $ this -> autocommitAfter ) { return $ this -> commit ( ) ; } return true ; }
Add pending document abstract action
@param string $actionType
@param array $data
@return mixed
Add pending document abstract action