Elasticsearch 查看分词结果

有时候需要核对分词器是否工作良好,可以使用Indices APIs的Analyze来分析。
官方API示例:

GET _analyze
{
  "tokenizer" : "keyword",
  "filter" : ["lowercase"],
  "text" : "this is a test"
}

Yii的PHP中示例:

/*
* 分析器查看用例 文本是如何被分析的
$params = [
    'index'    => $this->commonIndex,
    'analyzer' => 'number_zh_index_analyzer2',
    'text'     => '英雄联盟最强王者23'
];
echo json_encode($this->client->indices()->analyze($params));die();
*/

 

未经允许不得转载:阿藏博客 » Elasticsearch 查看分词结果