Elastica\Result::getVersion PHP Method

getVersion() public method

Returns the version information from the hit.
public getVersion ( ) : string | integer
return string | integer Document version
    public function getVersion()
    {
        return $this->getParam('_version');
    }

Usage Example

 /**
  * Returns the version number of this document as returned by ElasticSearch
  *
  * If this is a new document, this function returns 1
  *
  * @return int
  */
 public function version()
 {
     if ($this->_result) {
         return $this->_result->getVersion();
     }
     return 1;
 }