original_string: public function updateIndex(Array $fields = array())
      {
          // Use the specified fields for
          // the update.
          if ($fields) {
              $body = $fields;
          }
          // Or get the model's modified fields.
          elseif ($this->isDirty()) {
              $body = $this->getDirty();
          }
          else {
              return true;
          }
  
          foreach ($body as $field => $value) {
              if ($value instanceof Carbon) {
                  $body[$field] = $value->toDateTimeString();
              }
          }
          
          $params = $this->basicElasticParams(true);
          $params['body']['doc'] = $body;
  
          try {
              return $this->getElasticClient()->update($params);
          }
          catch (Missing404Exception $e) {
              return false;
          }
      }
code: public function updateIndex(Array $fields = array())
      {
          // Use the specified fields for
          // the update.
          if ($fields) {
              $body = $fields;
          }
          // Or get the model's modified fields.
          elseif ($this->isDirty()) {
              $body = $this->getDirty();
          }
          else {
              return true;
          }
  
          foreach ($body as $field => $value) {
              if ($value instanceof Carbon) {
                  $body[$field] = $value->toDateTimeString();
              }
          }
          
          $params = $this->basicElasticParams(true);
          $params['body']['doc'] = $body;
  
          try {
              return $this->getElasticClient()->update($params);
          }
          catch (Missing404Exception $e) {
              return false;
          }
      }
code_tokens: public function updateIndex ( Array $ fields = array ( ) ) { // Use the specified fields for // the update. if ( $ fields ) { $ body = $ fields ; } // Or get the model's modified fields. elseif ( $ this -> isDirty ( ) ) { $ body = $ this -> getDirty ( ) ; } else { return true ; } foreach ( $ body as $ field => $ value ) { if ( $ value instanceof Carbon ) { $ body [ $ field ] = $ value -> toDateTimeString ( ) ; } } $ params = $ this -> basicElasticParams ( true ) ; $ params [ 'body' ] [ 'doc' ] = $ body ; try { return $ this -> getElasticClient ( ) -> update ( $ params ) ; } catch ( Missing404Exception $ e ) { return false ; } }
docstring: Updates the model's index.
  
  @param array $fields
  @return array|bool
docstring_tokens: Updates the model s index .