No handler for type [text] declared on field [content]
Install
1.compile
checkout ik version respective to your elasticsearch version
git checkout tags/{version}
mvn package
copy and unzip target/releases/elasticsearch-analysis-ik-{version}.zip
to your-es-root/plugins/ik
2.restart elasticsearch
Tips:
ik_max_word: 会将文本做最细粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,中华人民,中华,华人,人民共和国,人民,人,民,共和国,共和,和,国国,国歌”,会穷尽各种可能的组合;
ik_smart: 会做最粗粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,国歌”。
Quick Example
1.create a index
- curl -XPUT http://localhost:9200/index
2.create a mapping
- curl -XPOST http://localhost:9200/index/fulltext/_mapping -d'
- {
- "fulltext": {
- "_all": {
- "analyzer": "ik_max_word",
- "search_analyzer": "ik_max_word",
- "term_vector": "no",
- "store": "false"
- },
- "properties": {
- "content": {
- "type": "text",
- "analyzer": "ik_max_word",
- "search_analyzer": "ik_max_word",
- "include_in_all": "true",
- "boost": 8
- }
- }
- }
- }'
- 上面这个rest请求在2.3.4版本的es服务器上会执行失败,原因是es 2.3.4上面还没有text这种类型,"type":"text" 改为 "type":"String"即可
3.index some docs
- curl -XPOST http://localhost:9200/index/fulltext/1 -d'
- {"content":"美国留给伊拉克的是个烂摊子吗"}
- '
- curl -XPOST http://localhost:9200/index/fulltext/2 -d'
- {"content":"公安部:各地校车将享最高路权"}
- '
- curl -XPOST http://localhost:9200/index/fulltext/3 -d'
- {"content":"中韩渔警冲突调查:韩警平均每天扣1艘中国渔船"}
- '
- curl -XPOST http://localhost:9200/index/fulltext/4 -d'
- {"content":"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首"}
- '
4.query with highlighting
- curl -XPOST http://localhost:9200/index/fulltext/_search -d'
- {
- "query" : { "match" : { "content" : "中国" }},
- "highlight" : {
- "pre_tags" : ["<tag1>", "<tag2>"],
- "post_tags" : ["</tag1>", "</tag2>"],
- "fields" : {
- "content" : {}
- }
- }
- }
- '
No handler for type [text] declared on field [content]的更多相关文章
- "reason":"No handler for type [attachment] declared on field [file]" 最完全解决方案
0.elasticsearch-mapper-attachments 2.3.4安装 mapper-attachments安装方法分两类,在线和离线: 在线安装 bin/elasticsearch-p ...
- 可否控制<link type=text/css rel=stylesheet href=style.css>
本篇文章主要介绍了"可否控制<link type=text/css rel=stylesheet href=style.css> ", 主要涉及到可否控制<lin ...
- js让text值不可改变,同<input type="text" readonly="readonly" />
<input type="text" size="60" name="j01" value="www.52jscn.com ...
- chrome下input[type=text]的placeholder不垂直居中的问题解决
http://blog.csdn.net/do_it__/article/details/6789699 <input type="text" placeholder=&qu ...
- <input type="text"/>未输入时属性value的默认值--js学习之路
在百度ife刷题是自己的一个错误引发了我对<input type="text"/>的学习. 先贴代码: <!DOCTYPE html> <html&g ...
- Resource interpreted as Script but transferred with MIME type text/plain:
我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...
- 取出type="button" 和type="text" 里面的值显示在页面
<script type="text/JavaScript> function changeLink() { document.getElementById("nod ...
- input[type=text]点击之后无边框, 一进页面就显示光标
1.input[type=text]点击之后无边框 :outline:none; 2. 一进页面就显示光标: <script Language="javascript"> ...
- 001. 为input type=text 时设置默认值
1. 前端HTML代码 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Defa ...
随机推荐
- CentOS下利用Docker部署Surging
原文:CentOS下利用Docker部署Surging 1. 安装Centos, 配置固定ip配置文件地址vi /etc/sysconfig/network-scripts/ifcfg-ens33`` ...
- msys 中打开系统程序
按照msys 后发现sh自带的vim不好用,下载安装了个gvim,在etc/profile中作如下设置: alias gvim="D:/Program\ Files/Vim/vim73/gv ...
- vim编辑器经常使用命令
高级一些的编辑器,都会包括宏功能,vim当然不能缺少了.在vim中使用宏是很方便的: :qx 開始记录宏,并将结果存入寄存器xq 退出记录模式@x 播放记录在x寄存器中的宏命令 ...
- 写PPT的先扬后抑的思路
近期给一个客户做IT战略规划. 基本结束了,客户要求写点有高度的东西.我想也是,尽管眼下的PPT也触及到战略和行业的问题,可是没有总结出来.于是就挖空心思,琢磨了三天.写了4页PPT.改动了几遍.还算 ...
- shiro简单配置(转)
注:这里只介绍spring配置模式. 因为官方例子虽然中有更加简洁的ini配置形式,但是使用ini配置无法与spring整合.而且两种配置方法一样,只是格式不一样. 涉及的jar包 Jar包名称 版本 ...
- [AngularFire2] Pagination
Let's see how to do pagination in Firebase: For the init loading, we only want 3 items: findLessonsK ...
- 为什么一款优秀的移动工具类应用必须开发PCclient?
移动大潮气势汹汹,PC端似乎已经一条腿跨进了坟墓. 作为一个windows开发者.难免有些焦灼. windows真的已死吗?真的无用武之地了吗? 或许是人云亦云吧. 突然看到了这篇文章,感触颇深. 文 ...
- 36、ALSA声卡驱动和应用
(注意:内核上电的时候会把一些没运行的控制器模块的时钟都关掉,所有在写驱动的时候需要在使用的使用使用clk_get和clk_enable使能时钟) (说明:与ALSA声卡对应的是OSS架构,第二期视频 ...
- [Angular2 Form] patchValue, setValue and reset() for Form
Learn how to update part of form model, full form model and reset whole form. We have form definetio ...
- 《SPA设计与架构》之MV*框架
原文 简书原文:https://www.jianshu.com/p/39f8f0aefdc2 大纲 1.认识MV*框架 2.传统UI设计模式 3.对框架的本质认识——框架有效性和框架分类 4.MV*基 ...