您的位置:首页 > 其它

ElasticSearch 获取分词的Token

2015-07-10 15:00 549 查看
  用ES建好索引,有时候需要获取索引中的Token。ES提供了两个接口,链接如下:

https://www.elastic.co/guide/en/elasticsearch/reference/1.6/docs-termvectors.html#_term_information

https://www.elastic.co/guide/en/elasticsearch/reference/1.6/docs-multi-termvectors.html#docs-multi-termvectors

典型的用法如下,

curl -XGET 'http://localhost:9200/twitter/tweet/1/_termvector?pretty=true'


需要给出索引名,表名,文档id,及关键词_termvector. 但是,本地测试,上述命令是没有结果的,需要指出相关的域.

curl -XGET 'http://localhost:9200/twitter/tweet/1/_termvector?fields=text,...'


这个命令行,还有其他一些选项,如:

curl -XGET 'http://localhost:9200/twitter/tweet/1/_termvector?pretty=true' -d '{
"fields" : ["text"],
"offsets" : true,
"payloads" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true
}'


具体请看文档.

另一个命令差不多,不过是可以可以作用在多个索引上.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: