elasticsearch-7.8.0 + ik中文分词,打造全文搜索
我的环境是centos7 64位的系统,需要jdk1.8以上版本
elasticsearch官网下载地址:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-linux-x86_64.tar.gz &
下载ik分词插件:https://github.com/medcl/elasticsearch-analysis-ik/releases
下载完elasticsearch直接解压就行了,我是解压到/usr/local/elasticsearch-7.8.0文件夹
mkdir /usr/local/elasticsearch-7.8.0/plugins/ik
把ik分词插件解压到usr/local/elasticsearch-7.8.0/plugins/ik 文件夹
新建用户组 groupadd esgroup
新增用户 useradd esroot -g esgroup -p esroot
设置权限 chown -R esroot:esgroup /usr/local/
elasticsearch-7.8.0
切换权限 su esroot
用root是无法启动的哈!要用esroot用户启动:/usr/local/elasticsearch-7.8.0/bin/elasticsearch&
curl 127.0.0.1:9200 查看
elasticsearch是否启动成功
[aaa@qq.com plugins]$ curl 127.0.0.1:9200
{
"name" : "email.buruyouni.com",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "2kk4PsMnQHevnK8w1kkUAQ",
"version" : {
"number" : "7.8.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
"build_date" : "2020-06-14T19:35:50.234439Z",
"build_snapshot" : false,
"lucene_version" : "8.5.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
查看ik的分词,我这里用的是:ik_max_word模式
curl -H "Content-Type: application/json" http://localhost:9200/_analyze -X POST --data '{ "text":"广东省佛山市","analyzer": "ik_max_word"}'
{
"tokens": [
{
"token": "广东省",
"start_offset": 0,
"end_offset": 3,
"type": "CN_WORD",
"position": 0
},
{
"token": "广东",
"start_offset": 0,
"end_offset": 2,
"type": "CN_WORD",
"position": 1
},
{
"token": "省",
"start_offset": 2,
"end_offset": 3,
"type": "CN_CHAR",
"position": 2
},
{
"token": "佛山市",
"start_offset": 3,
"end_offset": 6,
"type": "CN_WORD",
"position": 3
},
{
"token": "佛山",
"start_offset": 3,
"end_offset": 5,
"type": "CN_WORD",
"position": 4
},
{
"token": "市",
"start_offset": 5,
"end_offset": 6,
"type": "CN_CHAR",
"position": 5
}
]
}
添加,put请求类型,添加id=3的文档(我这里用的是postman啦)
post请求类型,更新id=5的文档的id字段和total_price字段:
delete请求类型,删除id=3的文档:
上一篇: java java异常
下一篇: JAVE获取视频文件属性信息(比较全)
推荐阅读
-
elasticsearch-7.8.0 + ik中文分词,打造全文搜索
-
分享mysql中文全文搜索:中文分词简单函数
-
php 中文分词 全文搜索引擎 xunsearch 实例
-
站内搜索引擎初探:haystack全文检索,whoosh搜索引擎,jieba中文分词
-
ES第九天-分词,自定义分析器,中文分词器ik与基于中文分词器ik的全文检索
-
分享mysql中文全文搜索:中文分词简单函数
-
全文检索服务SOLR3.3支持IK中文分词
-
solr6.6搜索环境搭建、IK中文分词、同义词、拼音、solrj的使用
-
二、ubuntu10.0.4下mysql配合sphinx和中文分词的全文搜索
-
php环境下使用elasticSearch+ik分词器进行全文搜索