[关闭]
@nalan90 2019-09-21T17:59:26.000000Z 字数 4281 阅读 1064

Elasticsearch入门

ELK学习


简介


基础概念


抽象与类比

image_1dl8t0rvpun4qg6l33sdls7t1j.png-62.6kB


数据类型


mapping & setting

  1. PUT /employees/
  2. {
  3. "mappings" : {
  4. "properties" : {
  5. "age" : {
  6. "type" : "integer"
  7. },
  8. "gender" : {
  9. "type" : "keyword"
  10. },
  11. "job" : {
  12. "type" : "text",
  13. "fields" : {
  14. "keyword" : {
  15. "type" : "keyword",
  16. "ignore_above" : 50
  17. }
  18. }
  19. },
  20. "name" : {
  21. "type" : "keyword"
  22. },
  23. "salary" : {
  24. "type" : "integer"
  25. }
  26. }
  27. }
  28. }
  29. GET employees
  30. {
  31. "employees" : {
  32. "aliases" : { },
  33. "mappings" : {
  34. "properties" : {
  35. "age" : {
  36. "type" : "integer"
  37. },
  38. "gender" : {
  39. "type" : "keyword"
  40. },
  41. "job" : {
  42. "type" : "text",
  43. "fields" : {
  44. "keyword" : {
  45. "type" : "keyword",
  46. "ignore_above" : 50
  47. }
  48. }
  49. },
  50. "name" : {
  51. "type" : "keyword"
  52. },
  53. "salary" : {
  54. "type" : "integer"
  55. }
  56. }
  57. },
  58. "settings" : {
  59. "index" : {
  60. "creation_date" : "1569033870664",
  61. "number_of_shards" : "1",
  62. "number_of_replicas" : "1",
  63. "uuid" : "ibWvaiBKQcOn2ve-gszKAg",
  64. "version" : {
  65. "created" : "7010099"
  66. },
  67. "provided_name" : "employees"
  68. }
  69. }
  70. }
  71. }

倒排索引


分词器

  1. github: https://github.com/KennFalcon/elasticsearch-analysis-hanlp
  2. [es@dmp-datanode02 ~]$ cd elasticsearch-7.1.0
  3. [es@dmp-datanode02 elasticsearch-7.1.0]$ pwd
  4. /home/es/elasticsearch-7.1.0
  5. [es@dmp-datanode02 elasticsearch-7.1.0]$ ./bin/elasticsearch-plugin list
  6. ## 安装指定版本的分词器
  7. [es@dmp-datanode02 elasticsearch-7.1.0]$ ./bin/elasticsearch-plugin install https://github.com/KennFalcon/elasticsearch-analysis-hanlp/releases/download/v7.1.0/elasticsearch-analysis-hanlp-7.1.0.zip
  8. [es@dmp-datanode02 elasticsearch-7.1.0]$ ./bin/elasticsearch-plugin list
  9. analysis-hanlp

常用操作CURD


基于词项与基于全文的搜索

结构化搜索


聚合搜索


网红campaign广场


总结

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注