spring-data-elasticsearch 或 spring-boot-starter-data-elasticsearch 客户端是连接不上elasticsearch7.3.0的。
$ docker pull elasticsearch:6.8.2
$ docker run -d --name elasticsearch -i -t -p 8200:9200 -p 8300:9300 -e "discovery.type=single-node" elasticsearch:6.8.2
http://【ip地址】:8200 是否打印如下信息:
{
"name" : "4r-PIss",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "J1Rxv_oJQmuwnPbUjKMiEQ",
"version" : {
"number" : "6.8.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "b506955",
"build_date" : "2019-07-24T15:24:41.545295Z",
"build_snapshot" : false,
"lucene_version" : "7.7.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
$ docker exec -it 容器id /bin/bash
cluster.name: docker-cluster
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.type: single-node
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
ealsticsearch只是后端提供各种api,那么怎么直观的使用它呢?elasticsearch-head将是一款专门针对于elasticsearch的客户端工具,类似mysql的sqlyog或者navicat
elasticsearch-head配置包,下载地址:https://github.com/mobz/elasticsearch-head
ElasticSearch 默认采用分词器, 单个字分词 ,效果很差
https://github.com/medcl/elasticsearch-analysis-ik/releases
每个es版本对应的ik分词器的版本
下载 elasticsearch-analysis-ik-6.8.2.zip 解压到 你的安装目录\elasticsearch-6.8.2\plugins\ik 没有ik目录新建一个即可
登入到容器中yum 安装 zip unzip
$ docker exec -it 容器id /bin/bash
$ yum install -y unzip zip
拷贝 elasticsearch-analysis-ik-6.8.2.zip 到容器中去
$ docker cp 主机文件路径 容器ID:容器路径
登录容器中解压 elasticsearch-analysis-ik-6.8.2.zip 到 你的安装目录\elasticsearch-6.8.2\plugins\ik
$ cd /usr/share/elasticsearch/plugins/ik
$ unzip elasticsearch-analysis-ik-6.8.2.zip的路径 -d ./
重启容器即可