public function highlight($fields = ['_all' => []], $parameters = [], $preTag = '<mark>', $postTag = '</mark>')
    {
        $highlight = new Highlight();
        $highlight->setTags([$preTag], [$postTag]);

        foreach ($fields as $field => $fieldParams) {
            $highlight->addField($field, $fieldParams);
        }

        if ($parameters) {
            $highlight->setParameters($parameters);
        }

        $this->query->addHighlight($highlight);

        return $this;
    }
public function highlight($fields = ['_all' => []], $parameters = [], $preTag = '<mark>', $postTag = '</mark>')
    {
        $highlight = new Highlight();
        $highlight->setTags([$preTag], [$postTag]);

        foreach ($fields as $field => $fieldParams) {
            $highlight->addField($field, $fieldParams);
        }

        if ($parameters) {
            $highlight->setParameters($parameters);
        }

        $this->query->addHighlight($highlight);

        return $this;
    }
public function highlight ( $ fields = [ '_all' => [ ] ] , $ parameters = [ ] , $ preTag = '<mark>' , $ postTag = '</mark>' ) { $ highlight = new Highlight ( ) ; $ highlight -> setTags ( [ $ preTag ] , [ $ postTag ] ) ; foreach ( $ fields as $ field => $ fieldParams ) { $ highlight -> addField ( $ field , $ fieldParams ) ; } if ( $ parameters ) { $ highlight -> setParameters ( $ parameters ) ; } $ this -> query -> addHighlight ( $ highlight ) ; return $ this ; }
Add a highlight to result.

@param array  $fields
@param array  $parameters
@param string $preTag
@param string $postTag

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html

@return $this
Add a highlight to result .