code: 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
          );
      }
docs: Index a new document or update it if existing
  
  @return array
  @param array $document
  @param mixed $id Optional
  @param array $options
  @throws \ElasticSearch\Exception