使用postman对elasticsearch接口调用
- 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"
- }
- 返回:
如果有些词我们不想拆看怎么办,配置自己的分词配置:
打开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接口调用的更多相关文章
- php 客户端调用elasticsearch接口
1.php调用elasticsearch接口[参考资料:https://www.cnblogs.com/php0916/articles/6587340.html] /data/www/syhuo.n ...
- 如何使用Postman快速简单的调用快递物流平台快递鸟API接口
前沿 快递鸟是一家聚合类的第三方快递物流平台,目前该平台提供的产品主要以API为主.由于API不能直观的看到产品效果,需要进行API对接联调成功后才能真实的看到产品的实际效果.但是如果一上来就写代码进 ...
- node.js 接口调用示例
测试用例git地址(node.js部分):https://github.com/wuyongxian20/node-api.git 项目架构如下: controllers: 文件夹下为接口文件 log ...
- 干掉 Postman?测试接口直接生成API文档,ApiPost真香!
实不相瞒我的收藏夹里躺着很多优质的开发工具,我有个爱好平时遇到感兴趣的开发工具都会记录下来,然后有时间在慢慢研究.前几天刚给同事分享一款非常好用的API文档工具,真的被惊艳到了,粉丝朋友们也感受一下吧 ...
- 《C#微信开发系列(3)-获取接口调用凭据》
3.0获取接口调用凭据 ①接口说明 access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token.开发者需要进行妥善保存.access_token的存储至少要保留 ...
- asp.net mvc短信接口调用——阿里大于API开发心得
互联网上有许多公司提供短信接口服务,诸如网易云信.阿里大于等等.我在自己项目里需要使用到短信服务起到通知作用,实际开发周期三天,完成配置.开发和使用,总的说,阿里大于提供的接口易于开发,非常的方便,短 ...
- PHP 使用 curl_* 系列函数和 curl_multi_* 系列函数进行多接口调用时的性能对比
在页面中调用的服务较多时,使用并行方式,即使用 curl_multi_* 系列函数耗时要小于 curl_* 系列函数. 测试环境 操作系统:Windows x64 Server:Apache PHP: ...
- Spring AOP在函数接口调用性能分析及其日志处理方面的应用
面向切面编程可以实现在不修改原来代码的情况下,增加我们所需的业务处理逻辑,比如:添加日志.本文AOP实例是基于Aspect Around注解实现的,我们需要在调用API函数的时候,统计函数调用的具体信 ...
- 基于JAVA的全国天气预报接口调用示例
step1:选择本文所示例的接口"全国天气预报接口" url:https://www.juhe.cn/docs/api/id/39/aid/87step2:每个接口都需要传入一个参 ...
随机推荐
- FastAPI 学习之路(四)
系列文章: FastAPI 学习之路(一)fastapi--高性能web开发框架 FastAPI 学习之路(二) FastAPI 学习之路(三) 之前的文章分享了如何去在请求中增加参数,本文我们将分享 ...
- Java(40)网络编程
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201659.html 博客主页:https://www.cnblogs.com/testero ...
- /usr/bin/python^M: bad interpreter: No such file or directory
利用如下命令查看文件格式 :set ff 或 :set fileformat 可以看到如下信息 fileformat=dos 或 fileformat=unix 利用如下命令修改文件格式 :set f ...
- SharkCTF2021 BabyGame
web类题. 访问题给页面,页面里没啥信息.抓包,发现: 访问它,发现是一个游戏. F12之后看调试器里的js代码,发现: console.log("balabalabala"); ...
- django-admin和django-admin.py的区别
问题 django初学者在使用django-admin创建项目时容易出现无法创建的错误,这是因为网上很多教程用的都是django-admin.py创建的项目,不出意外的话,你输入相同的命令会发现项目没 ...
- 23.合并k个有序链表
合并 k 个排序链表,返回合并后的排序链表.请分析和描述算法的复杂度. 示例: 输入: [ 1->4->5, 1->3->4, 2->6 ] 输出: 1-&g ...
- Noip模拟46 2021.8.23
给了签到题,但除了签到题其他的什么也不会.... T1 数数 人均$AC$,没什么好说的,就是排个序,然后双指针交换着往中间移 1 #include<bits/stdc++.h> 2 #d ...
- MyBatis源码分析(六):Spring整合分析
一.Mybatis-Spring源码结构 二.Myabtis交给Spring管理的组件 1. dataSource 数据源 配置一个数据源,只要是实现了javax.sql.DataSource接口就可 ...
- Ubuntu鼠标变十字 不能点击
出现这种情况,应该是bash 直接运行了python文件 系统中出现了一个import 进程. python文件中除了注释应该是import在最前边 ps -ef|grep import 可以查看系统 ...
- vue打包后反编译到源代码(reverse-sourcemap)
因为突然的疫情把我困在家了,家里的电脑没有源代码,但是需求还要改,工作还得继续... 从服务器下载了之前上传的打包后的文件,找了一圈反编译方法,得救了,在此记录一下. 1.npm install -- ...