post 新增

get 查询

put更新

post http://127.0.0.1:9200/index4/type1
{"node":0} {
"_index": "index4",
"_type": "type1",
"_id": "W_WMOHYBA6aNNN1EWEI0",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
} 查询: http://127.0.0.1:9200/index4/type1/_search {
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "index4",
"_type": "type1",
"_id": "W_WMOHYBA6aNNN1EWEI0",
"_score": 1.0,
"_source": {
"node": 0
}
},
{
"_index": "index4",
"_type": "type1",
"_id": "XPWROHYBA6aNNN1EL0Ig",
"_score": 1.0,
"_source": {
"node": 0,
"age": 3
}
}
]
}
}

  刚学有点懵懵的....

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

IK分词效果有两种,一种是ik_max_word(最大分词)和ik_smart(最小分词)
post http://127.0.0.1:9200/_analyze
请求参数
{
"analyzer":"ik_smart",
"text":"中国abc" }
返回
{
"tokens": [
{
"token": "中国abc",
"start_offset": 0,
"end_offset": 5,
"type": "CN_WORD",
"position": 0
}
]
} 如果是最细力度划分:
请求
{
"analyzer":"ik_max_word",
"text":"中国abc" } 返回:
{
    "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

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

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

重启es项目

加载自己的配置文件

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

  

{
"tokens": [
{
"token": "我",
"start_offset": 0,
"end_offset": 1,
"type": "CN_CHAR",
"position": 0
},
{
"token": "非常",
"start_offset": 1,
"end_offset": 3,
"type": "CN_WORD",
"position": 1
},
{
"token": "喜欢",
"start_offset": 3,
"end_offset": 5,
"type": "CN_WORD",
"position": 2
},
{
"token": "三号小玩家",
"start_offset": 5,
"end_offset": 10,
"type": "CN_WORD",
"position": 3
},
{
"token": "他",
"start_offset": 10,
"end_offset": 11,
"type": "CN_CHAR",
"position": 4
},
{
"token": "的",
"start_offset": 11,
"end_offset": 12,
"type": "CN_CHAR",
"position": 5
},
{
"token": "网民",
"start_offset": 12,
"end_offset": 14,
"type": "CN_WORD",
"position": 6
},
{
"token": "player3",
"start_offset": 14,
"end_offset": 21,
"type": "CN_WORD",
"position": 7
},
{
"token": "是",
"start_offset": 21,
"end_offset": 22,
"type": "CN_CHAR",
"position": 8
},
{
"token": "我",
"start_offset": 22,
"end_offset": 23,
"type": "CN_CHAR",
"position": 9
},
{
"token": "喜欢",
"start_offset": 23,
"end_offset": 25,
"type": "CN_WORD",
"position": 10
},
{
"token": "的",
"start_offset": 25,
"end_offset": 26,
"type": "CN_CHAR",
"position": 11
},
{
"token": "类型",
"start_offset": 26,
"end_offset": 28,
"type": "CN_WORD",
"position": 12
}
]
}

  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. 初识Tomcat源码

    Tomcat 部署的三种方式 打包成war包 部署到webapp目录录下 为什么要打包成war包,而不是jar包呢? 因为jar包可能是一个项目,也可能是一个依赖,Tomcat读取容易造成混淆.于是一 ...

  2. Java(9)数组详解

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

  3. 用例图示例:使用系统边界表示多个项目 / Using System Boundary to model Multiple Projects in Use Case Diagram

    什么是用例图? 用例是一种捕获系统功能需求的技术.用例描述了一个独立于实现细节的期望行为.用例的目标是捕获用户设想的所有系统级功能.从用户的角度来看,用例是关于系统应该做什么的.用例捕获系统利益相关者 ...

  4. 记一次 .NET 某资讯论坛 CPU爆高分析

    大概有11天没发文了,真的不是因为懒,本想前几天抽空写,不知道为啥最近求助的朋友比较多,一天都能拿到2-3个求助dump,晚上回来就是一顿分析,有点意思的是大多朋友自己都分析了几遍或者公司多年的牛皮藓 ...

  5. [软软软]技术博客-Commitizen优化git commit

    工具介绍 commitizen/cz-cli是一个规范git commit的工具,使用它代替git commit能够方便有效地写好提交的log,使得团队项目的版本信息更清晰. 安装 (全局安装) np ...

  6. OO第四次博客作业--第四单元总结及课程总结

    一.总结第四单元两次作业的架构设计 1.1 第一次作业 类图如下: 为了突出类.接口.方法.属性.和参数之间的层次结构关系,我为 Class 和 Interface 和 Operation 分别建立了 ...

  7. springcloud整合seata

    springcloud整合seata 一.背景 二.项目结构 三.实现功能: 四.项目使用到的技术 五.整合步骤 1.引入spring-cloud-starter-alibaba-seata jar包 ...

  8. 使用vuex简单的实现系统中的状态管理

    最近项目中用到了vue,其中状态的集中管理使用到了vuex,因此就学习vuex做一个简单的记录.vuex的官方网址如下: https://vuex.vuejs.org/zh-cn/  vuex 当我们 ...

  9. 计算机网络之流量控制(停止-等待协议、滑动窗口、后退N帧协议GBN、选择重传协议SR)、滑动窗口、可靠传输机制

    文章转自:https://blog.csdn.net/weixin_43914604/article/details/104908762 学习课程:<2019王道考研计算机网络> 学习目的 ...

  10. Python super(Todo,self).__init__() TypeError: super() argument 1 must be type, not classobj

    示例如下 class A(): def __init__(self):pass class B(A): def __init__(self): super(A, self).__init__() 当调 ...