lib/Elastica/Query/InnerHits.php
public function addScriptField(string $name, AbstractScript $script): self
    {
        if (!isset($this->_params['script_fields'])) {
            $this->_params['script_fields'] = new ScriptFields();
        }

        $this->_params['script_fields']->addScript($name, $script);

        return $this;
    }
public function addScriptField(string $name, AbstractScript $script): self
    {
        if (!isset($this->_params['script_fields'])) {
            $this->_params['script_fields'] = new ScriptFields();
        }

        $this->_params['script_fields']->addScript($name, $script);

        return $this;
    }
public function addScriptField ( string $ name , AbstractScript $ script ) : self { if ( ! isset ( $ this -> _params [ 'script_fields' ] ) ) { $ this -> _params [ 'script_fields' ] = new ScriptFields ( ) ; } $ this -> _params [ 'script_fields' ] -> addScript ( $ name , $ script ) ; return $ this ; }
Adds a Script to the aggregation.

@param string         $name
@param AbstractScript $script

@return $this
Adds a Script to the aggregation .