Elasticsearch\Bulk::delete PHP Method

delete() public method

delete a document
public delete ( mixed $id = false, string $index, string $type, array $options = [] ) : Bulk
$id mixed
$index string Index
$type string Type
$options array Parameters to pass to delete action
return Bulk
    public function delete($id = false, $index, $type, array $options = array())
    {
        $params = array('_id' => $id, '_index' => $index, '_type' => $type);
        foreach ($options as $key => $value) {
            $params['_' . $key] = $value;
        }
        $operation = array(array('delete' => $params));
        $this->operations[] = $operation;
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Flush this index/type combination
  *
  * @return array
  * @param mixed $id If id is supplied, delete that id for this index
  *                  if not wipe the entire index
  * @param array $options Parameters to pass to delete action
  */
 public function delete($id = false, $options = array())
 {
     if ($this->bulk) {
         return $this->bulk->delete($id, $this->index, $this->type, $options);
     }
     return $this->transport->delete($id, $options);
 }