Architecture.pngserver_list.png


说在前面:以下操作均是在kibana控制台中进行!

一、COS

1、创建索引

  1. PUT /cos_resource_index
  2. 注:
  3. 删除索引
  4. DELETE /cos_resource_index
  5. 删除索引下的所有数据
  6. POST /cos_resource_index/_delete_by_query
  7. {
  8. "query": {
  9. "match_all" :{}
  10. }
  11. }
  12. 查询所有数据
  13. POST /cos_resource_index/_search
  14. {
  15. "query": {
  16. "match_all": {}
  17. },
  18. "sort": [
  19. {
  20. "last_modified": {
  21. "order": "desc"
  22. }
  23. }
  24. ]
  25. }

2、创建mapping

  1. PUT /cos_resource_index/_mapping
  2. {
  3. "properties": {
  4. "id": {
  5. "index": "true",
  6. "type": "long"
  7. },
  8. "parent_id": {
  9. "index": "true",
  10. "type": "long"
  11. },
  12. "file_name": {
  13. "index": "true",
  14. "type": "text",
  15. "analyzer": "ik_max_word"
  16. },
  17. "key": {
  18. "index": "true",
  19. "type": "keyword"
  20. },
  21. "tags": {
  22. "index": "true",
  23. "type": "text",
  24. "analyzer": "ik_max_word"
  25. },
  26. "content_type": {
  27. "index": "true",
  28. "type": "keyword"
  29. },
  30. "cos_type": {
  31. "index": "true",
  32. "type": "integer"
  33. },
  34. "root_dir_path": {
  35. "index": "true",
  36. "type": "keyword"
  37. },
  38. "parent_dir_path": {
  39. "index": "true",
  40. "type": "keyword"
  41. },
  42. "region": {
  43. "index": "true",
  44. "type": "keyword"
  45. },
  46. "bucket_name": {
  47. "index": "true",
  48. "type": "keyword"
  49. },
  50. "status": {
  51. "index": "true",
  52. "type": "integer"
  53. },
  54. "acl_flag": {
  55. "index": "true",
  56. "type": "integer"
  57. },
  58. "last_modified": {
  59. "index": "true",
  60. "type": "date",
  61. "format": "yyyy-MM-dd HH:mm:ss"
  62. }
  63. }
  64. }

3、验证

  1. PUT /cos_resource_index/_doc/246482648847446016
  2. {
  3. "id": 246482648847446016,
  4. "parent_id": 246482641276727296,
  5. "key": "image/1111/hhh/好吧.JPG",
  6. "acl_flag": 2,
  7. "bucket_name": "tret-1251733385",
  8. "file_name": "好吧.JPG",
  9. "region": "ap-chengdu",
  10. "status": 0,
  11. "tags": "表情包",
  12. "cos_type": 0,
  13. "content_type": "application/octet-stream",
  14. "parent_dir_path": "image/1111/hhh/",
  15. "root_dir_path": "image/",
  16. "last_modified": "2021-04-02 20:59:57" #必须给格式化的字符串类型
  17. }
  18. GET /cos_resource_index/_doc/246482648847446016

二、article

1、创建索引

  1. PUT /article_index
  2. 注:
  3. 删除索引
  4. DELETE /article_index
  5. 删除索引下的所有数据
  6. POST /article_index/_delete_by_query
  7. {
  8. "query": {
  9. "match_all" :{}
  10. }
  11. }
  12. 查询所有数据
  13. POST /article_index/_search
  14. {
  15. "query": {
  16. "match_all": {}
  17. },
  18. "sort": [
  19. {
  20. "publish_time": {
  21. "order": "desc"
  22. }
  23. }
  24. ]
  25. }

2、创建mapping

  1. PUT /article_index/_mapping
  2. {
  3. "properties": {
  4. "id": {
  5. "index": "true",
  6. "type": "long"
  7. },
  8. "title": {
  9. "index": "true",
  10. "type": "text",
  11. "analyzer": "ik_max_word"
  12. },
  13. "author": {
  14. "index": "true",
  15. "type": "keyword"
  16. },
  17. "cname": {
  18. "index": "true",
  19. "type": "keyword"
  20. },
  21. "from_where": {
  22. "index": "true",
  23. "type": "keyword"
  24. },
  25. "labels": {
  26. "index": "true",
  27. "type": "text",
  28. "analyzer": "ik_max_word"
  29. },
  30. "publish_time": {
  31. "index": "true",
  32. "type": "date",
  33. "format": "yyyy-MM-dd HH:mm:ss"
  34. },
  35. "like_number": {
  36. "index": "true",
  37. "type": "integer"
  38. },
  39. "comment_number": {
  40. "index": "true",
  41. "type": "integer"
  42. },
  43. "scan_number": {
  44. "index": "true",
  45. "type": "integer"
  46. },
  47. "status": {
  48. "index": "true",
  49. "type": "integer"
  50. },
  51. "is_top": {
  52. "index": "true",
  53. "type": "integer"
  54. },
  55. "month_day": {
  56. "index": "true",
  57. "type": "keyword"
  58. },
  59. "year": {
  60. "index": "true",
  61. "type": "keyword"
  62. },
  63. "pictures": {
  64. "index": "true",
  65. "type": "keyword"
  66. },
  67. "brief": {
  68. "index": "true",
  69. "type": "text",
  70. "analyzer": "ik_max_word"
  71. },
  72. "content": {
  73. "index": "true",
  74. "type": "text",
  75. "analyzer": "ik_max_word"
  76. }
  77. }
  78. }

3、验证

  1. PUT /article_index/_doc/235903824002904064
  2. {
  3. "id": 235903824002904064,
  4. "author": "spartacus",
  5. "brief": "为啥平安在脉脉上的风评这么差?清一色的劝退、别来。 本人平安科技技术岗,总体感觉还行。 早九晚六,不加班,6-7点很多人就走了,9点以后办公室基本没几个人了,除非发版会比较晚。 每次过节都有过节费,总计5880元/年,每个月都有福利礼包。 薪资待遇也还行,虽然base确实不高,但拿个普通c绩效年终",
  6. "cname": "人文",
  7. "like_number": 5,
  8. "comment_number": 5,
  9. "content": "<p>随便写点什么吧</p>",
  10. "from_where": "原创",
  11. "is_top": 1,
  12. "labels": "脉脉,风评差",
  13. "month_day": "05.10",
  14. "year": "2021",
  15. "pictures": "https://github.githubassets.com/images/icons/emoji/unicode/1f9d1.png?v8",
  16. "publish_time": "2021-03-15 15:59:08", #必须给格式化的字符串类型
  17. "scan_number": 100,
  18. "status": 0,
  19. "title": "为啥平安在脉脉上的风评这么差?"
  20. }
  21. GET /article_index/_doc/235903824002904064

三、CHAT

1、创建索引

  1. PUT /chat_message_index
  2. 注:
  3. 删除索引
  4. DELETE /chat_message_index
  5. 删除索引下的所有数据
  6. POST /chat_message_index/_delete_by_query
  7. {
  8. "query": {
  9. "match_all" :{}
  10. }
  11. }
  12. 查询所有数据
  13. POST /chat_message_index/_search
  14. {
  15. "query": {
  16. "match_all": {}
  17. },
  18. "sort": [
  19. {
  20. "sendTime": {
  21. "order": "desc"
  22. }
  23. }
  24. ]
  25. }

2、创建mapping

  1. PUT /chat_message_index/_mapping
  2. {
  3. "properties": {
  4. "id": {
  5. "index": "true",
  6. "type": "long"
  7. },
  8. "belongProviderUserId": {
  9. "index": "true",
  10. "type": "text"
  11. },
  12. "chatId": {
  13. "index": "true",
  14. "type": "text"
  15. },
  16. "code": {
  17. "index": "true",
  18. "type": "integer"
  19. },
  20. "from": {
  21. "index": "true",
  22. "type": "text"
  23. },
  24. "to": {
  25. "index": "true",
  26. "type": "text"
  27. },
  28. "content": {
  29. "index": "true",
  30. "type": "keyword"
  31. },
  32. "type": {
  33. "index": "true",
  34. "type": "integer"
  35. },
  36. "fromNickname": {
  37. "index": "true",
  38. "type": "text"
  39. },
  40. "fromHeadimage": {
  41. "index": "true",
  42. "type": "text"
  43. },
  44. "fromProviderId": {
  45. "index": "true",
  46. "type": "text"
  47. },
  48. "fromProviderUserId": {
  49. "index": "true",
  50. "type": "text"
  51. },
  52. "toNickname": {
  53. "index": "true",
  54. "type": "text"
  55. },
  56. "toHeadimage": {
  57. "index": "true",
  58. "type": "text"
  59. },
  60. "toProviderId": {
  61. "index": "true",
  62. "type": "text"
  63. },
  64. "toProviderUserId": {
  65. "index": "true",
  66. "type": "text"
  67. },
  68. "sendTime": {
  69. "index": "true",
  70. "type": "date",
  71. "format": "yyyy-MM-dd HH:mm:ss"
  72. }
  73. }
  74. }

3、验证

  1. PUT /chat_message_index/_doc/246482648847446016
  2. {
  3. "id": 246482648847446016,
  4. "belongProviderUserId":"123",
  5. "chatId": "123456",
  6. "code": 200,
  7. "from": "123",
  8. "to": "456",
  9. "content": "哈哈哈哈",
  10. "type": 2,
  11. "fromNickname": "张三",
  12. "fromHeadimage": "http://image.com/1111/hhh/123.JPG",
  13. "fromProviderId": "spartacus123",
  14. "fromProviderUserId": "123",
  15. "toNickname": "李四",
  16. "toHeadimage": "http://image.com/1111/hhh/456.JPG",
  17. "toProviderId": "spartacus456",
  18. "toProviderUserId": "456",
  19. "sendTime": "2021-04-02 20:59:57" #必须给格式化的字符串类型
  20. }
  21. GET /chat_message_index/_doc/246482648847446016

四、login

1、创建索引

  1. PUT /login_record_index
  2. 注:
  3. 删除索引
  4. DELETE /login_record_index
  5. 删除索引下的所有数据
  6. POST /login_record_index/_delete_by_query
  7. {
  8. "query": {
  9. "match_all" :{}
  10. }
  11. }
  12. 查询所有数据
  13. POST /login_record_index/_search
  14. {
  15. "query": {
  16. "match_all": {}
  17. },
  18. "sort": [
  19. {
  20. "login_time": {
  21. "order": "desc"
  22. }
  23. }
  24. ]
  25. }

2、创建mapping

  1. PUT /login_record_index/_mapping
  2. {
  3. "properties": {
  4. "id": {
  5. "index": "true",
  6. "type": "long"
  7. },
  8. "username": {
  9. "index": "true",
  10. "type": "text"
  11. },
  12. "user_type": {
  13. "index": "true",
  14. "type": "text"
  15. },
  16. "ip": {
  17. "index": "true",
  18. "type": "text"
  19. },
  20. "province": {
  21. "index": "true",
  22. "type": "text"
  23. },
  24. "city": {
  25. "index": "true",
  26. "type": "text"
  27. },
  28. "client": {
  29. "index": "true",
  30. "type": "text"
  31. },
  32. "login_time": {
  33. "index": "true",
  34. "type": "date",
  35. "format": "yyyy-MM-dd HH:mm:ss"
  36. }
  37. }
  38. }

3、验证

  1. PUT /login_record_index/_doc/246482648847446016
  2. {
  3. "id": 246482648847446016,
  4. "username":"123",
  5. "user_type": "qq",
  6. "ip": "127.0.0.1",
  7. "province": "广东省",
  8. "city": "深圳市",
  9. "client": "spartacus-sunday",
  10. "login_time": "2021-04-02 20:59:57" #必须给格式化的字符串类型
  11. }
  12. GET /login_record_index/_doc/246482648847446016

如果搞不定,请加群讨论,扫码关注,发送“加群”
mp_qrcode.jpg