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]的更多相关文章

  1. "reason":"No handler for type [attachment] declared on field [file]" 最完全解决方案

    0.elasticsearch-mapper-attachments 2.3.4安装 mapper-attachments安装方法分两类,在线和离线: 在线安装 bin/elasticsearch-p ...

  2. 可否控制<link type=text/css rel=stylesheet href=style.css>

    本篇文章主要介绍了"可否控制<link type=text/css rel=stylesheet href=style.css> ", 主要涉及到可否控制<lin ...

  3. js让text值不可改变,同<input type="text" readonly="readonly" />

    <input type="text" size="60"  name="j01" value="www.52jscn.com ...

  4. chrome下input[type=text]的placeholder不垂直居中的问题解决

    http://blog.csdn.net/do_it__/article/details/6789699 <input type="text" placeholder=&qu ...

  5. <input type="text"/>未输入时属性value的默认值--js学习之路

    在百度ife刷题是自己的一个错误引发了我对<input type="text"/>的学习. 先贴代码: <!DOCTYPE html> <html&g ...

  6. Resource interpreted as Script but transferred with MIME type text/plain:

    我用script做ajax跨域,请求返回的是个文本字符串,chrome提示:Resource interpreted as Script but transferred with MIME type ...

  7. 取出type="button" 和type="text" 里面的值显示在页面

    <script  type="text/JavaScript> function changeLink() { document.getElementById("nod ...

  8. input[type=text]点击之后无边框, 一进页面就显示光标

    1.input[type=text]点击之后无边框 :outline:none; 2. 一进页面就显示光标: <script Language="javascript"> ...

  9. 001. 为input type=text 时设置默认值

    1. 前端HTML代码 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Defa ...

随机推荐

  1. (转)windows 下 Java 及 Python 环境变量设置

    转自:http://www.cnblogs.com/zhj5chengfeng/archive/2013/01/01/2841253.html http://www.cnblogs.com/qiyes ...

  2. 使用Surging Mqtt 开发基于WS的MqttClient客户端

    原文:使用Surging Mqtt 开发基于WS的MqttClient客户端 最近一段时间由于要做一套智能设备系统,而有幸了解到Surging中的Mqtt broker,学习了很多东西本篇文章基于Su ...

  3. GO语言学习(九)Go 语言运算符

    运算符用于在程序运行时执行数学或逻辑运算. Go 语言内置的运算符有: 算术运算符 关系运算符 逻辑运算符 位运算符 赋值运算符 其他运算符 接下来让我们来详细看看各个运算符的介绍. 算术运算符 下表 ...

  4. 如何安装Python环境以及为Visual Studio 2012安装Python插件

    (一)首先,我机器上的开发环境安装的是Visual Studio 2012版本,系统为window7,64位,要安装的Python版本为python3.4-x64,双击安装包安装Python环境,需要 ...

  5. 火狐与IE的7个JavaScript差异

    作者注:本篇文章发表于2009.04.27,是一篇关于讨论Javascript在IE6.IE7和FF2+.FF3.0之间的存在的问题的文章. 虽然须要用冗长的JavaScript代码去识别特定的浏览器 ...

  6. 系统学习java高并发系列一

    转载请注明原创出处,谢谢! JAVA服务端或者后端需要大量的高并发计算,所以高并发在JAVA服务端或者后端编程中显的格外重要了. 首先需要有几个概念: 1.同步和异步 同步异步是来形容方法的一次调用的 ...

  7. C语言深度剖析-----函数与指针分析

    阅读代码的重要技巧 函数类型 函数指针 回调函数 使用示例 指针阅读技巧解析 例

  8. 快速杀死占用8080端口进程的批处理(kill-8080.bat)

    @echo off setlocal enabledelayedexpansion for /f "delims= tokens=1" %%i in ('netstat -aon ...

  9. Voronoi Diagram——维诺图

    Voronoi图定义   任意两点p 和q 之间的欧氏距离,记作 dist(p, q) .就平面情况而言,我们有           dist(p, q) =  (px-qx)2+ (py-qy)2 ...

  10. ng-cli搭建angular项目框架

    原文地址 https://www.jianshu.com/p/0a8f4b0f29b3 环境准备 以下步骤都不需要事先创建文件夹,只是环境的准备过程,只有到需要搭建项目的时候才需要创建文件夹用来存放项 ...