http://88250.b3log.org/full-text-search-elasticsearch#b3_solo_h3_0

IK分词器插件

(1)源码 
https://github.com/medcl/elasticsearch-analysis-ik

 
(2)releases 
https://github.com/medcl/elasticsearch-analysis-ik/releases

(3)复制zip地址 
https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.1.1/elasticsearch-analysis-ik-6.1.1.zip

4.2 安装插件

(1)elasticsearch-plugin

  1. [es@node1 elasticsearch-6.1.1]$ bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.1.1/elasticsearch-analysis-ik-6.1.1.zip
  2. -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.1.1/elasticsearch-analysis-ik-6.1.1.zip
  3. [=================================================] 100%
  4. -> Installed analysis-ik
  5. [es@node1 elasticsearch-6.1.1]$ ll plugins/
  6. total 0
  7. drwxr-xr-x 2 es es 199 Jan 7 08:52 analysis-ik
  8. [es@node1 elasticsearch-6.1.1]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

(2)查看目录

  1. [es@node1 elasticsearch-6.1.1]$ ll plugins/analysis-ik/
  2. total 1420
  3. -rw-r--r-- 1 es es 263965 Jan 7 08:52 commons-codec-1.9.jar
  4. -rw-r--r-- 1 es es 61829 Jan 7 08:52 commons-logging-1.2.jar
  5. -rw-r--r-- 1 es es 51658 Jan 7 08:52 elasticsearch-analysis-ik-6.1.1.jar
  6. -rw-r--r-- 1 es es 736658 Jan 7 08:52 httpclient-4.5.2.jar
  7. -rw-r--r-- 1 es es 326724 Jan 7 08:52 httpcore-4.4.4.jar
  8. -rw-r--r-- 1 es es 2666 Jan 7 08:52 plugin-descriptor.properties
  9. [es@node1 elasticsearch-6.1.1]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

4.3 重启elasticsearch

  1. [es@node1 elasticsearch-6.1.1]$ bin/elasticsearch
  2. [2018-01-07T09:01:17,283][INFO ][o.e.n.Node ] [] initializing ...
  3. [2018-01-07T09:01:17,421][INFO ][o.e.e.NodeEnvironment ] [cNWkQjt] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [14.3gb], net total_space [21.9gb], types [rootfs]
  4. [2018-01-07T09:01:17,422][INFO ][o.e.e.NodeEnvironment ] [cNWkQjt] heap size [1007.3mb], compressed ordinary object pointers [true]
  5. [2018-01-07T09:01:17,484][INFO ][o.e.n.Node ] node name [cNWkQjt] derived from node ID [cNWkQjt9SzKFNtyx8IIu-A]; set [node.name] to override
  6. [2018-01-07T09:01:17,484][INFO ][o.e.n.Node ] version[6.1.1], pid[3445], build[bd92e7f/2017-12-17T20:23:25.338Z], OS[Linux/3.10.0-514.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_112/25.112-b15]
  7. [2018-01-07T09:01:17,485][INFO ][o.e.n.Node ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/elasticsearch-6.1.1, -Des.path.conf=/opt/elasticsearch-6.1.1/config]
  8. [2018-01-07T09:01:19,000][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [aggs-matrix-stats]
  9. [2018-01-07T09:01:19,000][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [analysis-common]
  10. [2018-01-07T09:01:19,000][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [ingest-common]
  11. [2018-01-07T09:01:19,001][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-expression]
  12. [2018-01-07T09:01:19,001][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-mustache]
  13. [2018-01-07T09:01:19,001][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-painless]
  14. [2018-01-07T09:01:19,001][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [mapper-extras]
  15. [2018-01-07T09:01:19,001][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [parent-join]
  16. [2018-01-07T09:01:19,002][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [percolator]
  17. [2018-01-07T09:01:19,002][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [reindex]
  18. [2018-01-07T09:01:19,002][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [repository-url]
  19. [2018-01-07T09:01:19,002][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [transport-netty4]
  20. [2018-01-07T09:01:19,002][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [tribe]
  21. [2018-01-07T09:01:19,003][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded plugin [analysis-ik]
  22. [2018-01-07T09:01:21,678][INFO ][o.e.d.DiscoveryModule ] [cNWkQjt] using discovery type [zen]
  23. [2018-01-07T09:01:22,567][INFO ][o.e.n.Node ] initialized
  24. [2018-01-07T09:01:22,568][INFO ][o.e.n.Node ] [cNWkQjt] starting ...
  25. [2018-01-07T09:01:22,803][INFO ][o.e.t.TransportService ] [cNWkQjt] publish_address {192.168.80.131:9300}, bound_addresses {192.168.80.131:9300}
  26. [2018-01-07T09:01:22,837][INFO ][o.e.b.BootstrapChecks ] [cNWkQjt] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
  27. [2018-01-07T09:01:25,940][INFO ][o.e.c.s.MasterService ] [cNWkQjt] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{Xvho5gpPTuavakz227C_uA}{192.168.80.131}{192.168.80.131:9300}
  28. [2018-01-07T09:01:25,949][INFO ][o.e.c.s.ClusterApplierService] [cNWkQjt] new_master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{Xvho5gpPTuavakz227C_uA}{192.168.80.131}{192.168.80.131:9300}, reason: apply cluster state (from master [master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{Xvho5gpPTuavakz227C_uA}{192.168.80.131}{192.168.80.131:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
  29. [2018-01-07T09:01:25,993][INFO ][o.e.h.n.Netty4HttpServerTransport] [cNWkQjt] publish_address {192.168.80.131:9200}, bound_addresses {192.168.80.131:9200}
  30. [2018-01-07T09:01:25,993][INFO ][o.e.n.Node ] [cNWkQjt] started
  31. [2018-01-07T09:01:26,077][INFO ][o.w.a.d.Monitor ] try load config from /opt/elasticsearch-6.1.1/config/analysis-ik/IKAnalyzer.cfg.xml
  32. [2018-01-07T09:01:26,799][INFO ][o.e.g.GatewayService ] [cNWkQjt] recovered [2] indices into cluster_state
  33. [2018-01-07T09:01:27,526][INFO ][o.e.c.r.a.AllocationService] [cNWkQjt] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test][2], [test][0]] ...]).
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

4.3 测试IK中文分词器的基本功能

(1)ik_smart 
其中pretty本意”漂亮的”,表示以美观的形式打印出JSON格式响应。

  1. GET _analyze?pretty
  2. {
  3. "analyzer": "ik_smart",
  4. "text":"安徽省长江流域"
  5. }
  • 1
  • 2
  • 3
  • 4
  • 5

分词结果

  1. {
  2. "tokens": [
  3. {
  4. "token": "安徽省",
  5. "start_offset": 0,
  6. "end_offset": 3,
  7. "type": "CN_WORD",
  8. "position": 0
  9. },
  10. {
  11. "token": "长江流域",
  12. "start_offset": 3,
  13. "end_offset": 7,
  14. "type": "CN_WORD",
  15. "position": 1
  16. }
  17. ]
  18. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

 
(2)ik_max_word

  1. GET _analyze?pretty
  2. {
  3. "analyzer": "ik_max_word",
  4. "text":"安徽省长江流域"
  5. }
  • 1
  • 2
  • 3
  • 4
  • 5

分词结果

  1. {
  2. "tokens": [
  3. {
  4. "token": "安徽省",
  5. "start_offset": 0,
  6. "end_offset": 3,
  7. "type": "CN_WORD",
  8. "position": 0
  9. },
  10. {
  11. "token": "安徽",
  12. "start_offset": 0,
  13. "end_offset": 2,
  14. "type": "CN_WORD",
  15. "position": 1
  16. },
  17. {
  18. "token": "省长",
  19. "start_offset": 2,
  20. "end_offset": 4,
  21. "type": "CN_WORD",
  22. "position": 2
  23. },
  24. {
  25. "token": "长江流域",
  26. "start_offset": 3,
  27. "end_offset": 7,
  28. "type": "CN_WORD",
  29. "position": 3
  30. },
  31. {
  32. "token": "长江",
  33. "start_offset": 3,
  34. "end_offset": 5,
  35. "type": "CN_WORD",
  36. "position": 4
  37. },
  38. {
  39. "token": "江流",
  40. "start_offset": 4,
  41. "end_offset": 6,
  42. "type": "CN_WORD",
  43. "position": 5
  44. },
  45. {
  46. "token": "流域",
  47. "start_offset": 5,
  48. "end_offset": 7,
  49. "type": "CN_WORD",
  50. "position": 6
  51. }
  52. ]
  53. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53

(3)新词

  1. GET _analyze?pretty
  2. {
  3. "analyzer": "ik_smart",
  4. "text": "王者荣耀"
  5. }
  • 1
  • 2
  • 3
  • 4
  • 5

分词结果

  1. {
  2. "tokens": [
  3. {
  4. "token": "王者",
  5. "start_offset": 0,
  6. "end_offset": 2,
  7. "type": "CN_WORD",
  8. "position": 0
  9. },
  10. {
  11. "token": "荣耀",
  12. "start_offset": 2,
  13. "end_offset": 4,
  14. "type": "CN_WORD",
  15. "position": 1
  16. }
  17. ]
  18. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

4.4 扩展字典

(1)查看已有词典

  1. [es@node1 analysis-ik]$ pwd
  2. /opt/elasticsearch-6.1.1/config/analysis-ik
  3. [es@node1 analysis-ik]$ ll
  4. total 8260
  5. -rw-rw---- 1 es bigdata 5225922 Jan 7 08:52 extra_main.dic
  6. -rw-rw---- 1 es bigdata 63188 Jan 7 08:52 extra_single_word.dic
  7. -rw-rw---- 1 es bigdata 63188 Jan 7 08:52 extra_single_word_full.dic
  8. -rw-rw---- 1 es bigdata 10855 Jan 7 08:52 extra_single_word_low_freq.dic
  9. -rw-rw---- 1 es bigdata 156 Jan 7 08:52 extra_stopword.dic
  10. -rw-rw---- 1 es bigdata 625 Jan 7 08:52 IKAnalyzer.cfg.xml
  11. -rw-rw---- 1 es bigdata 3058510 Jan 7 08:52 main.dic
  12. -rw-rw---- 1 es bigdata 123 Jan 7 08:52 preposition.dic
  13. -rw-rw---- 1 es bigdata 1824 Jan 7 08:52 quantifier.dic
  14. -rw-rw---- 1 es bigdata 164 Jan 7 08:52 stopword.dic
  15. -rw-rw---- 1 es bigdata 192 Jan 7 08:52 suffix.dic
  16. -rw-rw---- 1 es bigdata 752 Jan 7 08:52 surname.dic
  17. [es@node1 analysis-ik]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

(2)自定义词典

  1. [es@node1 analysis-ik]$ mkdir custom
  2. [es@node1 analysis-ik]$ vi custom/new_word.dic
  3. [es@node1 analysis-ik]$ cat custom/new_word.dic
  4. 老铁
  5. 王者荣耀
  6. 洪荒之力
  7. 共有产权房
  8. 一带一路
  9. [es@node1 analysis-ik]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

(3)更新配置

  1. [es@node1 analysis-ik]$ vi IKAnalyzer.cfg.xml
  2. [es@node1 analysis-ik]$ cat IKAnalyzer.cfg.xml
  3. <?xml version="1.0" encoding="UTF-8"?>
  4. <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
  5. <properties>
  6. <comment>IK Analyzer 扩展配置</comment>
  7. <!--用户可以在这里配置自己的扩展字典 -->
  8. <entry key="ext_dict">custom/new_word.dic</entry>
  9. <!--用户可以在这里配置自己的扩展停止词字典-->
  10. <entry key="ext_stopwords"></entry>
  11. <!--用户可以在这里配置远程扩展字典 -->
  12. <!-- <entry key="remote_ext_dict">words_location</entry> -->
  13. <!--用户可以在这里配置远程扩展停止词字典-->
  14. <!-- <entry key="remote_ext_stopwords">words_location</entry> -->
  15. </properties>
  16. [es@node1 analysis-ik]$
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

(4)重启elasticsearch

  1. [es@node1 elasticsearch-6.1.1]$ bin/elasticsearch
  2. [2018-01-07T10:00:23,032][INFO ][o.e.n.Node ] [] initializing ...
  3. [2018-01-07T10:00:23,170][INFO ][o.e.e.NodeEnvironment ] [cNWkQjt] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [14.3gb], net total_space [21.9gb], types [rootfs]
  4. [2018-01-07T10:00:23,171][INFO ][o.e.e.NodeEnvironment ] [cNWkQjt] heap size [1007.3mb], compressed ordinary object pointers [true]
  5. [2018-01-07T10:00:23,209][INFO ][o.e.n.Node ] node name [cNWkQjt] derived from node ID [cNWkQjt9SzKFNtyx8IIu-A]; set [node.name] to override
  6. [2018-01-07T10:00:23,210][INFO ][o.e.n.Node ] version[6.1.1], pid[3574], build[bd92e7f/2017-12-17T20:23:25.338Z], OS[Linux/3.10.0-514.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_112/25.112-b15]
  7. [2018-01-07T10:00:23,210][INFO ][o.e.n.Node ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/elasticsearch-6.1.1, -Des.path.conf=/opt/elasticsearch-6.1.1/config]
  8. [2018-01-07T10:00:24,717][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [aggs-matrix-stats]
  9. [2018-01-07T10:00:24,717][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [analysis-common]
  10. [2018-01-07T10:00:24,718][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [ingest-common]
  11. [2018-01-07T10:00:24,718][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-expression]
  12. [2018-01-07T10:00:24,718][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-mustache]
  13. [2018-01-07T10:00:24,718][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [lang-painless]
  14. [2018-01-07T10:00:24,718][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [mapper-extras]
  15. [2018-01-07T10:00:24,719][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [parent-join]
  16. [2018-01-07T10:00:24,719][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [percolator]
  17. [2018-01-07T10:00:24,719][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [reindex]
  18. [2018-01-07T10:00:24,719][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [repository-url]
  19. [2018-01-07T10:00:24,719][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [transport-netty4]
  20. [2018-01-07T10:00:24,720][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded module [tribe]
  21. [2018-01-07T10:00:24,720][INFO ][o.e.p.PluginsService ] [cNWkQjt] loaded plugin [analysis-ik]
  22. [2018-01-07T10:00:27,866][INFO ][o.e.d.DiscoveryModule ] [cNWkQjt] using discovery type [zen]
  23. [2018-01-07T10:00:28,794][INFO ][o.e.n.Node ] initialized
  24. [2018-01-07T10:00:28,795][INFO ][o.e.n.Node ] [cNWkQjt] starting ...
  25. [2018-01-07T10:00:29,047][INFO ][o.e.t.TransportService ] [cNWkQjt] publish_address {192.168.80.131:9300}, bound_addresses {192.168.80.131:9300}
  26. [2018-01-07T10:00:29,093][INFO ][o.e.b.BootstrapChecks ] [cNWkQjt] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
  27. [2018-01-07T10:00:32,210][INFO ][o.e.c.s.MasterService ] [cNWkQjt] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{N6t0NiDmQp2vlrbx-FtcUQ}{192.168.80.131}{192.168.80.131:9300}
  28. [2018-01-07T10:00:32,217][INFO ][o.e.c.s.ClusterApplierService] [cNWkQjt] new_master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{N6t0NiDmQp2vlrbx-FtcUQ}{192.168.80.131}{192.168.80.131:9300}, reason: apply cluster state (from master [master {cNWkQjt}{cNWkQjt9SzKFNtyx8IIu-A}{N6t0NiDmQp2vlrbx-FtcUQ}{192.168.80.131}{192.168.80.131:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
  29. [2018-01-07T10:00:32,285][INFO ][o.e.h.n.Netty4HttpServerTransport] [cNWkQjt] publish_address {192.168.80.131:9200}, bound_addresses {192.168.80.131:9200}
  30. [2018-01-07T10:00:32,286][INFO ][o.e.n.Node ] [cNWkQjt] started
  31. [2018-01-07T10:00:32,326][INFO ][o.w.a.d.Monitor ] try load config from /opt/elasticsearch-6.1.1/config/analysis-ik/IKAnalyzer.cfg.xml
  32. [2018-01-07T10:00:32,905][INFO ][o.w.a.d.Monitor ] [Dict Loading] custom/new_word.dic
  33. [2018-01-07T10:00:33,279][INFO ][o.e.g.GatewayService ] [cNWkQjt] recovered [2] indices into cluster_state
  34. [2018-01-07T10:00:34,092][INFO ][o.e.c.r.a.AllocationService] [cNWkQjt] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test][3]] ...]).
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

从输出信息中可以看到

  1. [Dict Loading] custom/new_word.dic
  • 1

说明自定义词典已经加载了。

(5)重启Kibana 
重启Kibana后,从新执行下面命令

  1. GET _analyze?pretty
  2. {
  3. "analyzer": "ik_smart",
  4. "text":"王者荣耀"
  5. }
  • 1
  • 2
  • 3
  • 4
  • 5

分词结果

  1. {
  2. "tokens": [
  3. {
  4. "token": "王者荣耀",
  5. "start_offset": 0,
  6. "end_offset": 4,
  7. "type": "CN_WORD",
  8. "position": 0
  9. }
  10. ]
  11. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

19.1 高亮概述 参照官方文档 https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-request-highlighting.html Highlighters enable you to get highlighted snippets from one or more fields in your sea...
2018-01-19 10:41 阅读(7) 评论(0)
 
【这一节先占个坑,后面再更新】 https://www.elastic.co/guide/en/elasticsearch/reference/6.1/compound-queries.html Compound queries wrap other compound or leaf queries, either to combine their results and scores, to...
2018-01-18 22:13 阅读(8) 评论(0)
 
17.1 词项查询介绍 词项查询官网: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/term-level-queries.html While the full text queries will analyze the query string before executing, the term-level qu...
2018-01-17 23:14 阅读(17) 评论(0)
 
ElasticSearch 6.x 全文检索相关内容官方文档: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/full-text-queries.html The high-level full text queries are usually used for running full text queries on...
2018-01-17 11:17 阅读(22) 评论(0)
 
15.1 准备数据 [es@node1 ~]$ vi website.json [es@node1 ~]$ cat website.json { "index":{ "_index": "website", "_type": "blog", "_id": "1" }} { "title": "Ambari源码编译","author":"程裕强","postdate":"2016-12-2...
2018-01-17 10:51 阅读(25) 评论(0)
 
14.1 mapping参数概述 官方文档 https://www.elastic.co/guide/en/elasticsearch/reference/6.1/mapping-params.html ElasticSearch提供了丰富的映射参数对字段的映射进行参数设计,比如字段的分词器、字段权重、日期格式、检索模型等等。 14.2 analyzer https://www.el...
2018-01-14 22:33 阅读(40) 评论(0)
 
13.1 元数据概述 mapping元字段官网文档 https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-fields.html#_document_source_meta_fields mapping元字段是mapping映射中描述文档本身的字段,大致可以分为文档属性元数据、文档元数据、索引元数据、路...
2018-01-13 22:25 阅读(44) 评论(0)
 
12.1 字段类型概述 一级分类 二级分类 具体类型 核心类型 字符串类型 string,text,keyword 整数类型 integer,long,short,byte 浮点类型 double,float,half_float,scaled_floa...
2018-01-12 23:03 阅读(62) 评论(0)
 
11.1 Mapping概述 前文已经把ElasticSearch的核心概念和关系数据库做了一个对比,索引(index)相当于数据库,类型(type)相当于数据表,映射(Mapping)相当于数据表的表结构。ElasticSearch中的映射(Mapping)用来定义一个文档,可以定义所包含的字段以及字段的类型、分词器及属性等等。 映射可以分为动态映射和静态映射。 (1)动态映射 我们知道...
2018-01-12 22:14 阅读(54) 评论(0)
 
10.1 Bulk API如果文档数量非常庞大,商业运维中都是海量数据,一个一个操作文档显然不合实际。幸运的是ElasticSearch提供了文档的批量操作机制。我们已经知道mget允许一次性检索多个文档,ElasticSearch提供了Bulk API,可以执行批量索引、批量删除、批量更新等操作,也就是说Bulk API允许使用在单个步骤中进行多次 create 、 index 、 update...
2018-01-09 15:32 阅读(66) 评论(0)
 
9.1 冲突处理如果两个线程同时修改一个文档,这时就会发生冲突。比如某件商品存货100件,用户1下单买走1件,剩余99件;与此同时用户2也下单买走1件,但是用户2不知道用户1已经下单,看到剩余商品仍然是99件。这样造成系统中显示商品总数比实际数量要多,这种情况在商业系统中肯定是不能容忍的。 在数据库领域中,有两种方法通常被用来确保并发更新时变更不会丢失: 1、悲观并发控制 这种方法被关系型数据...
2018-01-09 14:58 阅读(94) 评论(0)
 
PUT blog/csdn/3?routing=chengyuqiang { "id":3, "title":"Java简介", "author":"chengyuqiang", "content":"Oracle Java" }{ "_index": "blog", "_type": "csdn", "_id": "3", "_version": 1, "res...
2018-01-09 11:43 阅读(56) 评论(0)
 
7.1 新建文档 index/type/id (1)一般格式 PUT blog/csdn/1 { "id":1, "title":"Elasticsearch简介", "author":"chengyuqiang", "content":"Elasticsearch是一个基于Lucene的搜索引擎" } { "_index": "blog", "_typ...
2018-01-09 10:13 阅读(61) 评论(0)
 
6.1 创建索引(1)简单方式PUT test{ "acknowledged": true, "shards_acknowledged": true, "index": "test" }(2)索引名不能包含大些字母PUT Test (3)重复创建PUT test(4)指定参数PUT blog { "settings": { "number_of_shards": 3,...
2018-01-09 09:32 阅读(80) 评论(0)
 
5.1 索引索引(index)是ElasticSearch存放具体数据的地方,是一类具有相似特征的文档的集合。ElasticSearch中索引的概念具有不同意思,这里的索引相当于关系数据库中的一个数据库实例。在ElasticSearch中索引还可以作为动词,表示对数据进行索引操作。5.2 类型在一个ElasticSearch索引中,可以有多个类型。一个类型是索引的一个逻辑上的分类,通常具有一组相同字...
2018-01-08 22:22 阅读(89) 评论(0)
 
4.1 elasticsearch-analysis-ik 6.1.1 (1)源码 https://github.com/medcl/elasticsearch-analysis-ik (2)releases https://github.com/medcl/elasticsearch-analysis-ik/releases (3)复制zip地址 https://github...
2018-01-06 21:04 阅读(213) 评论(0)
 
3.1 下载Kibana插件 https://www.elastic.co/downloads/kibana 注意,ElasticSearch版本是6.1.1,kibana的版本必须对应,所以,此处下载kibana-6.1.1-linux-x86_64.tar.gz [es@node1 ~]$ wget https://artifacts.elastic.co/downloads/kib...
2018-01-06 19:03 阅读(133) 评论(0)
 
2.1 Head插件简介 ElasticSearch-head是一个H5编写的ElasticSearch集群操作和管理工具,可以对集群进行傻瓜式操作。 显示集群的拓扑,并且能够执行索引和节点级别操作 搜索接口能够查询集群中原始json或表格格式的检索数据 能够快速访问并显示集群的状态 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果;...
2017-12-18 23:19 阅读(350) 评论(0)
 
1. 安装配置JDK 8 (1)下载并解压缩 [root@node1 ~]# tar -zxvf jdk-8u112-linux-x64.tar.gz -C /opt (2)编辑环境变量 vi /etc/profile.d/custom.sh [root@node1 ~]# vi /etc/profile.d/custom.sh [root@node1 ~]# cat /etc...
2017-12-18 22:21 阅读(215) 评论(0)
 
1、添加数据(1)创建Index[root@node3 ~]# curl -X PUT 'node3:9200/accounts' {"acknowledged":true,"shards_acknowledged":true,"index":"accounts"} [root@node3 ~]# (2)插入数据[root@node3 conf]# curl -X PUT 'node3:9200/a...
2017-12-13 15:17 阅读(84) 评论(0)

IK分词器插件elasticsearch-analysis-ik 6.1.1的更多相关文章

  1. docker上安装elasticsearch和ik分词器插件和header,实现分词功能

    docker run -di --name=tensquare_es -p 9200: -p 9300:9300 elasticsearch:5.6.8 创建elasticsearch容器(如果版本不 ...

  2. Linux下,非Docker启动Elasticsearch 6.3.0,安装ik分词器插件,以及使用Kibana测试Elasticsearch,

    Linux下,非Docker启动Elasticsearch 6.3.0 查看java版本,需要1.8版本 java -version yum -y install java 创建用户,因为elasti ...

  3. es-07-head插件-ik分词器插件

    5.x以后, es对head插件的支持并不是特别好 而且kibana的功能越来越强大, 建议使用kibana 1, head插件安装 在一台机器上安装head插件就可以了 1), 更新,安装依赖 su ...

  4. Elasticsearch 7.x - IK分词器插件(ik_smart,ik_max_word)

    一.安装IK分词器 Elasticsearch也需要安装IK分析器以实现对中文更好的分词支持. 去Github下载最新版elasticsearch-ik https://github.com/medc ...

  5. IK分词器插件

    (1)源码 https://github.com/medcl/elasticsearch-analysis-ik  (2)releases https://github.com/medcl/elast ...

  6. 通过docker安装elasticsearch和安装ik分词器插件及安装kibana

    前提: 已经安装好docker运行环境: 步骤: 1.安装elasticsearch 6.2.2版本,目前最新版是7.2.0,这里之所以选择6.2.2是因为最新的SpringBoot2.1.6默认支持 ...

  7. windows elasticsearch使用ik分词器插件后启动报错java.security.AccessControlException: access denied ("java.io.FilePermission" "D:...........\plugins\ik-analyzer\config\IKAnalyzer.cfg.xml" "read")

    删除es安装文件夹中空格,遂解决......(哭

  8. 搜索引擎ElasticSearch系列(五): ElasticSearch2.4.4 IK中文分词器插件安装

    一:IK分词器简介  IK Analyzer是一个开源的,基于java语言开发的轻量级的中文分词工具包.从2006年12月推出1.0版开始, IKAnalyzer已经推出了4个大版本.最初,它是以开源 ...

  9. 【ELK】【docker】【elasticsearch】1. 使用Docker和Elasticsearch+ kibana 5.6.9 搭建全文本搜索引擎应用 集群,安装ik分词器

    系列文章:[建议从第二章开始] [ELK][docker][elasticsearch]1. 使用Docker和Elasticsearch+ kibana 5.6.9 搭建全文本搜索引擎应用 集群,安 ...

随机推荐

  1. Opencv Mat的三种常用类型简介

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/47683127 本文主要介绍Opencv ...

  2. MFC Wizard创建的空应用程序中各个文件内容的解析

    创建的MFC应用程序名为:wd,那么: 一.wd.h解析 // wd.h : main header file for the WD application // #if !defined(AFX_W ...

  3. 在Linux终端使用W3M浏览器下载文件

    在Linux终端使用W3M浏览器下载文件 W3M 是3个基于Linux系统命令行的WEB网站浏览工具(w3m/Links/Lynx) 对于需要验证cookie 和来源的页面,比如163的超大附件,直接 ...

  4. poj--1488--TEX Quotes(水题)

    TEX Quotes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9672   Accepted: 5071 Descri ...

  5. HDU 5438 Ponds dfs模拟

    2015 ACM/ICPC Asia Regional Changchun Online 题意:n个池塘,删掉度数小于2的池塘,输出池塘数为奇数的连通块的池塘容量之和. 思路:两个dfs模拟就行了 # ...

  6. Debian9.5解决在root用户下启用VNC后lightdm+Xfce4只能使用root登录,其他用户无法登陆

    Debian9.5解决在root用户下启用VNC后lightdm+Xfce4只能使用root登录,其他用户无法登陆 最近在研究debian9.5 VNC的问题,当VNC使用tightVNC或tiger ...

  7. fgrep---指定的输入文件中的匹配模式的行

    fgrep命令是用来搜索 file 参数指定的输入文件(缺省为标准输入)中的匹配模式的行.fgrep 命令特别搜索 Pattern 参数,它们是固定的字符串.如果在 File 参数中指定一个以上的文件 ...

  8. https soap链接示例

    1.先安装soap扩展sudo yum install php-soap 2.安装openssL 3.function  issure($sn){//通过soap链接接口  进行确认是否是正确的sn码 ...

  9. 小米开源便签Notes-源码研究(1)-导出功能整体思路

    NotesListActivity是入口Activity. 响应菜单事件,我的手机是"左键菜单".如果菜单项的ID是"R.id.menu_export_text" ...

  10. SPI总线工作模式

    一.SPI总线工作模式 SPI总线有四种工作模式,是由时钟极性选择(CPOL)和时钟相位选择(CPHA)决定的. CPOL = 0 ,SPI总线空闲为低电平,CPOL = 1, SPI总线空闲为高电平 ...