lib/Elastica/Index.php
public function analyze(array $body, $args = [])
    {
        $endpoint = new Analyze();
        $endpoint->setBody($body);
        $endpoint->setParams($args);

        $data = $this->requestEndpoint($endpoint)->getData();

        // Support for "Explain" parameter, that returns a different response structure from Elastic
        // @see: https://www.elastic.co/guide/en/elasticsearch/reference/current/_explain_analyze.html
        if (isset($body['explain']) && $body['explain']) {
            return $data['detail'];
        }

        return $data['tokens'];
    }
public function analyze(array $body, $args = [])
    {
        $endpoint = new Analyze();
        $endpoint->setBody($body);
        $endpoint->setParams($args);

        $data = $this->requestEndpoint($endpoint)->getData();

        // Support for "Explain" parameter, that returns a different response structure from Elastic
        // @see: https://www.elastic.co/guide/en/elasticsearch/reference/current/_explain_analyze.html
        if (isset($body['explain']) && $body['explain']) {
            return $data['detail'];
        }

        return $data['tokens'];
    }
public function analyze ( array $ body , $ args = [ ] ) { $ endpoint = new Analyze ( ) ; $ endpoint -> setBody ( $ body ) ; $ endpoint -> setParams ( $ args ) ; $ data = $ this -> requestEndpoint ( $ endpoint ) -> getData ( ) ; // Support for "Explain" parameter, that returns a different response structure from Elastic // @see: https://www.elastic.co/guide/en/elasticsearch/reference/current/_explain_analyze.html if ( isset ( $ body [ 'explain' ] ) && $ body [ 'explain' ] ) { return $ data [ 'detail' ] ; } return $ data [ 'tokens' ] ; }
Analyzes a string.

Detailed arguments can be found here in the link

@param array $body String to be analyzed
@param array $args OPTIONAL Additional arguments

@return array Server response

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html
Analyzes a string .