Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用php api分析字符串_Php_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Query String_Analyzer - Fatal编程技术网 elasticsearch,query-string,analyzer,Php,elasticsearch,Query String,Analyzer" /> elasticsearch,query-string,analyzer,Php,elasticsearch,Query String,Analyzer" />

如何使用php api分析字符串

如何使用php api分析字符串,php,elasticsearch,query-string,analyzer,Php,elasticsearch,Query String,Analyzer,如何使用PHP API使用此函数。我没有找到解决这个问题的方法 curl -XGET 'localhost:9200/_analyze?analyzer=standard' -d 'this is a test' 我需要访问它,因为我需要访问通过script\u score计算我的分数的查询字符串。当然,不会分析查询字符串。所以我必须分开做 我知道这不是一个好的解决方案,但我直到现在才找到替代方案。它位于索引名称空间中: /** * $params['index'] = (string) T

如何使用PHP API使用此函数。我没有找到解决这个问题的方法

curl -XGET 'localhost:9200/_analyze?analyzer=standard' -d 'this is a test'
我需要访问它,因为我需要访问通过script\u score计算我的分数的查询字符串。当然,不会分析查询字符串。所以我必须分开做


我知道这不是一个好的解决方案,但我直到现在才找到替代方案。

它位于索引名称空间中:

 /**
* $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'];
}

它位于索引名称空间中:

 /**
* $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'];
}