ElasticSearch\Transport\Memcached::index PHP Method

index() public method

Index a new document or update it if existing
public index ( array $document, mixed $id = false, array $options = [] ) : array
$document array
$id mixed Optional
$options array
return array
    public function index($document, $id = false, array $options = array())
    {
        if ($id === false) {
            throw new \ElasticSearch\Exception("Memcached transport requires id when indexing");
        }
        $document = json_encode($document);
        $url = $this->buildUrl(array($this->type, $id));
        $response = $this->conn->set($url, $document);
        return array('ok' => $response);
    }