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 ...
随机推荐
- java三大特性:封装、继承、多态
Java三大特性之封装 一.定义 封装性指的是将对象的状态信息隐藏在对象内部,不允许外部程序直接访问对象内部的信息,而是通过该类所提供的方法来实现对内部信息的操作和访问. 二.使用封装的好处: 1 ...
- js进阶 12-18 jquery如何实现自定义右键菜单(把问题分细)
js进阶 12-18 jquery如何实现自定义右键菜单(把问题分细) 一.总结 一句话总结:用鼠标右键事件contextmenu,阻止系统默认事件,让做好的右键菜单显示出来,并且显示在我们出现的位 ...
- HttpClient证书回调问题解决
/// <summary> /// httpclient请求 /// </summary> /// <param name=&q ...
- Maven报错Missing artifact jdk.tools:jdk.tools:jar:1.7--转
原文地址:http://blog.csdn.net/u013281331/article/details/40824707 在Eclipse中检出Maven工程,一直报这个错:“Missing art ...
- python3中sum
摘自https://blog.csdn.net/ikerpeng/article/details/17026011 其实python中sum有两种 一种是python自己的sum 另一种是python ...
- HDU 1214 圆桌会议 圆环逆序
http://acm.hdu.edu.cn/showproblem.php?pid=1214 题目大意: 一群人围着桌子座,如果在一分钟内一对相邻的人交换位置,问多少分钟后才能得到与原始状态相反的座位 ...
- P2P网贷中的4种理财业务模式
线上3种 直投标:线上理财人直接购买借款人的标,平台只是起个"撮合"作用,收点借款人的服务费. 借款人不还钱,有的平台会帮"借款人"还 ...
- Vertx简介
今天看了一篇很不错的关于Vertx的简介,转载下. 原文链接:http://www.csdn.net/article/2015-12-21/2826533?utm_source=tuicool& ...
- 在mac中导入hadoop2.6.0源代码至eclipse 分类: A1_HADOOP 2015-04-12 09:27 342人阅读 评论(0) 收藏
一.环境准备 1.安装jdk.maven等 2.下载hadoop源代码,并解压 3.将tools.jar复制到Classes中,具体原因见http://wiki.apache.org/hadoop/H ...
- ZOJ 1203 Swordfish MST
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1203 大意: 给出一些点,求MST 把这几天的MST一口气发上来. kru ...