1. post 新增
  2.  
  3. get 查询
  4.  
  5. put更新
  6.  
  7. post http://127.0.0.1:9200/index4/type1
  8. {"node":0}
  9.  
  10. {
  11. "_index": "index4",
  12. "_type": "type1",
  13. "_id": "W_WMOHYBA6aNNN1EWEI0",
  14. "_version": 1,
  15. "result": "created",
  16. "_shards": {
  17. "total": 2,
  18. "successful": 1,
  19. "failed": 0
  20. },
  21. "_seq_no": 0,
  22. "_primary_term": 1
  23. }
  24.  
  25. 查询:
  26.  
  27. http://127.0.0.1:9200/index4/type1/_search
  28.  
  29. {
  30. "took": 2,
  31. "timed_out": false,
  32. "_shards": {
  33. "total": 1,
  34. "successful": 1,
  35. "skipped": 0,
  36. "failed": 0
  37. },
  38. "hits": {
  39. "total": {
  40. "value": 2,
  41. "relation": "eq"
  42. },
  43. "max_score": 1.0,
  44. "hits": [
  45. {
  46. "_index": "index4",
  47. "_type": "type1",
  48. "_id": "W_WMOHYBA6aNNN1EWEI0",
  49. "_score": 1.0,
  50. "_source": {
  51. "node": 0
  52. }
  53. },
  54. {
  55. "_index": "index4",
  56. "_type": "type1",
  57. "_id": "XPWROHYBA6aNNN1EL0Ig",
  58. "_score": 1.0,
  59. "_source": {
  60. "node": 0,
  61. "age": 3
  62. }
  63. }
  64. ]
  65. }
  66. }

  刚学有点懵懵的....

之前安装了es的ik分词器,继续试试...

  1. IK分词效果有两种,一种是ik_max_word(最大分词)和ik_smart(最小分词)
  2. post http://127.0.0.1:9200/_analyze
  3. 请求参数
  4. {
  5. "analyzer":"ik_smart",
  6. "text":"中国abc"
  7.  
  8. }
  9. 返回
  10. {
  11. "tokens": [
  12. {
  13. "token": "中国abc",
  14. "start_offset": 0,
  15. "end_offset": 5,
  16. "type": "CN_WORD",
  17. "position": 0
  18. }
  19. ]
  20. }
  21.  
  22. 如果是最细力度划分:
  23. 请求
  24. {
  25. "analyzer":"ik_max_word",
  26. "text":"中国abc"
  27.  
  28. }
  29.  
  30. 返回:
{
    "tokens": [
        {
            "token": "中国",
            "start_offset": 0,
            "end_offset": 2,
            "type": "CN_WORD",
            "position": 0
        },
        {
            "token": "abc",
            "start_offset": 2,
            "end_offset": 5,
            "type": "ENGLISH",
            "position": 1
        }
    ]
}

  如果有些词我们不想拆看怎么办,配置自己的分词配置:

打开ik/config/IKAnalyzer.cfg.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
  3. <properties>
  4. <comment>IK Analyzer 扩展配置</comment>
  5. <!--用户可以在这里配置自己的扩展字典 -->
  6. <entry key="ext_dict">player3.dic</entry>
  7. <!--用户可以在这里配置自己的扩展停止词字典-->
  8. <entry key="ext_stopwords"></entry>
  9. <!--用户可以在这里配置远程扩展字典 -->
  10. <!-- <entry key="remote_ext_dict">words_location</entry> -->
  11. <!--用户可以在这里配置远程扩展停止词字典-->
  12. <!-- <entry key="remote_ext_stopwords">words_location</entry> -->
  13. </properties>

 新建player3.dic文件,写入自己的分词配置

重启es项目

加载自己的配置文件

  1. {
  2. "analyzer":"ik_smart",
  3. "text":"我非常喜欢三号小玩家他的网民player3是我喜欢的类型"
  4.  
  5. }

  

  1. {
  2. "tokens": [
  3. {
  4. "token": "我",
  5. "start_offset": 0,
  6. "end_offset": 1,
  7. "type": "CN_CHAR",
  8. "position": 0
  9. },
  10. {
  11. "token": "非常",
  12. "start_offset": 1,
  13. "end_offset": 3,
  14. "type": "CN_WORD",
  15. "position": 1
  16. },
  17. {
  18. "token": "喜欢",
  19. "start_offset": 3,
  20. "end_offset": 5,
  21. "type": "CN_WORD",
  22. "position": 2
  23. },
  24. {
  25. "token": "三号小玩家",
  26. "start_offset": 5,
  27. "end_offset": 10,
  28. "type": "CN_WORD",
  29. "position": 3
  30. },
  31. {
  32. "token": "他",
  33. "start_offset": 10,
  34. "end_offset": 11,
  35. "type": "CN_CHAR",
  36. "position": 4
  37. },
  38. {
  39. "token": "的",
  40. "start_offset": 11,
  41. "end_offset": 12,
  42. "type": "CN_CHAR",
  43. "position": 5
  44. },
  45. {
  46. "token": "网民",
  47. "start_offset": 12,
  48. "end_offset": 14,
  49. "type": "CN_WORD",
  50. "position": 6
  51. },
  52. {
  53. "token": "player3",
  54. "start_offset": 14,
  55. "end_offset": 21,
  56. "type": "CN_WORD",
  57. "position": 7
  58. },
  59. {
  60. "token": "是",
  61. "start_offset": 21,
  62. "end_offset": 22,
  63. "type": "CN_CHAR",
  64. "position": 8
  65. },
  66. {
  67. "token": "我",
  68. "start_offset": 22,
  69. "end_offset": 23,
  70. "type": "CN_CHAR",
  71. "position": 9
  72. },
  73. {
  74. "token": "喜欢",
  75. "start_offset": 23,
  76. "end_offset": 25,
  77. "type": "CN_WORD",
  78. "position": 10
  79. },
  80. {
  81. "token": "的",
  82. "start_offset": 25,
  83. "end_offset": 26,
  84. "type": "CN_CHAR",
  85. "position": 11
  86. },
  87. {
  88. "token": "类型",
  89. "start_offset": 26,
  90. "end_offset": 28,
  91. "type": "CN_WORD",
  92. "position": 12
  93. }
  94. ]
  95. }

  ok啦

使用postman对elasticsearch接口调用的更多相关文章

  1. php 客户端调用elasticsearch接口

    1.php调用elasticsearch接口[参考资料:https://www.cnblogs.com/php0916/articles/6587340.html] /data/www/syhuo.n ...

  2. 如何使用Postman快速简单的调用快递物流平台快递鸟API接口

    前沿 快递鸟是一家聚合类的第三方快递物流平台,目前该平台提供的产品主要以API为主.由于API不能直观的看到产品效果,需要进行API对接联调成功后才能真实的看到产品的实际效果.但是如果一上来就写代码进 ...

  3. node.js 接口调用示例

    测试用例git地址(node.js部分):https://github.com/wuyongxian20/node-api.git 项目架构如下: controllers: 文件夹下为接口文件 log ...

  4. 干掉 Postman?测试接口直接生成API文档,ApiPost真香!

    实不相瞒我的收藏夹里躺着很多优质的开发工具,我有个爱好平时遇到感兴趣的开发工具都会记录下来,然后有时间在慢慢研究.前几天刚给同事分享一款非常好用的API文档工具,真的被惊艳到了,粉丝朋友们也感受一下吧 ...

  5. 《C#微信开发系列(3)-获取接口调用凭据》

    3.0获取接口调用凭据 ①接口说明 access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token.开发者需要进行妥善保存.access_token的存储至少要保留 ...

  6. asp.net mvc短信接口调用——阿里大于API开发心得

    互联网上有许多公司提供短信接口服务,诸如网易云信.阿里大于等等.我在自己项目里需要使用到短信服务起到通知作用,实际开发周期三天,完成配置.开发和使用,总的说,阿里大于提供的接口易于开发,非常的方便,短 ...

  7. PHP 使用 curl_* 系列函数和 curl_multi_* 系列函数进行多接口调用时的性能对比

    在页面中调用的服务较多时,使用并行方式,即使用 curl_multi_* 系列函数耗时要小于 curl_* 系列函数. 测试环境 操作系统:Windows x64 Server:Apache PHP: ...

  8. Spring AOP在函数接口调用性能分析及其日志处理方面的应用

    面向切面编程可以实现在不修改原来代码的情况下,增加我们所需的业务处理逻辑,比如:添加日志.本文AOP实例是基于Aspect Around注解实现的,我们需要在调用API函数的时候,统计函数调用的具体信 ...

  9. 基于JAVA的全国天气预报接口调用示例

    step1:选择本文所示例的接口"全国天气预报接口" url:https://www.juhe.cn/docs/api/id/39/aid/87step2:每个接口都需要传入一个参 ...

随机推荐

  1. FastAPI 学习之路(四)

    系列文章: FastAPI 学习之路(一)fastapi--高性能web开发框架 FastAPI 学习之路(二) FastAPI 学习之路(三) 之前的文章分享了如何去在请求中增加参数,本文我们将分享 ...

  2. Java(40)网络编程

    作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201659.html 博客主页:https://www.cnblogs.com/testero ...

  3. /usr/bin/python^M: bad interpreter: No such file or directory

    利用如下命令查看文件格式 :set ff 或 :set fileformat 可以看到如下信息 fileformat=dos 或 fileformat=unix 利用如下命令修改文件格式 :set f ...

  4. SharkCTF2021 BabyGame

    web类题. 访问题给页面,页面里没啥信息.抓包,发现: 访问它,发现是一个游戏. F12之后看调试器里的js代码,发现: console.log("balabalabala"); ...

  5. django-admin和django-admin.py的区别

    问题 django初学者在使用django-admin创建项目时容易出现无法创建的错误,这是因为网上很多教程用的都是django-admin.py创建的项目,不出意外的话,你输入相同的命令会发现项目没 ...

  6. 23.合并k个有序链表

    合并 k 个排序链表,返回合并后的排序链表.请分析和描述算法的复杂度. 示例: 输入: [   1->4->5,   1->3->4,   2->6 ] 输出: 1-&g ...

  7. Noip模拟46 2021.8.23

    给了签到题,但除了签到题其他的什么也不会.... T1 数数 人均$AC$,没什么好说的,就是排个序,然后双指针交换着往中间移 1 #include<bits/stdc++.h> 2 #d ...

  8. MyBatis源码分析(六):Spring整合分析

    一.Mybatis-Spring源码结构 二.Myabtis交给Spring管理的组件 1. dataSource 数据源 配置一个数据源,只要是实现了javax.sql.DataSource接口就可 ...

  9. Ubuntu鼠标变十字 不能点击

    出现这种情况,应该是bash 直接运行了python文件 系统中出现了一个import 进程. python文件中除了注释应该是import在最前边 ps -ef|grep import 可以查看系统 ...

  10. vue打包后反编译到源代码(reverse-sourcemap)

    因为突然的疫情把我困在家了,家里的电脑没有源代码,但是需求还要改,工作还得继续... 从服务器下载了之前上传的打包后的文件,找了一圈反编译方法,得救了,在此记录一下. 1.npm install -- ...