分布式搜索引擎ElasticSearch-Elasticsearch6查看分词器效果
之前的es版本是5.x,查看分词器效果可以直接在URL中指定分词器和查询词,方法是GET,如下:
http://localhost:9200/_analyze?analyzer=ik_smart&text=快乐奔跑
现在安装了es6.x,发现用原来的办法报错:
==============
{"error":{"root_cause":[{"type":"parse_exception","reason":"request body or source parameter is required"}],"type":"parse_exception","reason":"request body or source parameter is required"},"status":400}
==================
后来发现,es6.x查看分词效果,可以使用GET或者POST方法,但是分词器和查询词需要以json的形式写在body里。
http://192.168.2.10:9200/_analyze?pretty=true
{
"analyzer":"chinese",
"text": "快乐奔跑"
}