code: public function index($document, $id=false, array $options = array()) {
          if ($this->bulk) {
              return $this->bulk->index($document, $id, $this->index, $this->type, $options);
          }
          return $this->transport->index($document, $id, $options);
      }
docs: Index a new document or update it if existing
  
  @return array
  @param array $document
  @param mixed $id Optional
  @param array $options Allow sending query parameters to control indexing further
  _refresh_ *bool* If set to true, immediately refresh the shard after indexing