如何使用php api分析字符串

How is it possible to use this function using the PHP API. I didn't find a method for that.

curl -XGET 'localhost:9200/_analyze?analyzer=standard' -d 'this is a test'

I need to access it, because I need to have access to the query string calculating my score via script_score. The query string isn't analysed, of course. So I have to do that separately.

I know that's not a good solution, but I didn't find an alternative until now.

It's in the Indices name space:

 /**
* $params['index'] = (string) The name of the index to scope the operation
* ['analyzer'] = (string) The name of the analyzer to use
* ['field'] = (string) Use the analyzer configured for this field (instead of passing the analyzer name)
* ['filters'] = (list) A comma-separated list of filters to use for the analysis
* ['prefer_local'] = (boolean) With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)
* ['text'] = (string) The text on which the analysis should be performed (when request body is not used)
* ['tokenizer'] = (string) The name of the tokenizer to use for the analysis
* ['format'] = (enum) Format of the output
* ['body'] = (enum) Format of the output
*
* @param $params array Associative array of parameters
*
* @return array
*/
public function analyze($params = array())
{
$index = $this->extractArgument($params, 'index');
$body = $this->extractArgument($params, 'body');
/** @var callback $endpointBuilder */
$endpointBuilder = $this->dicEndpoints;
/** @var \Elasticsearch\Endpoints\Indices\Analyze $endpoint */
$endpoint = $endpointBuilder('Indices\Analyze');
$endpoint->setIndex($index)
->setBody($body);
$endpoint->setParams($params);
$response = $endpoint->performRequest();
return $response['data'];
}

https://github.com/elasticsearch/elasticsearch-php/blob/master/src/Elasticsearch/Namespaces/IndicesNamespace.php