spring boot 1.x支持elasticsearch <5.x
elasticsearch安装:按官网安装步骤:
(2)tar -xvf elasticsearch-2.3.4.tar.gz
(3)cd elasticsearch-2.3.4/bin
(4)./elasticsearch
elasticsearch配置:
打开ES的config文件夹下的elasticsearch.yml;
配置文件如下:
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-name
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: name
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /opt/modules/elasticsearch-2.3.4/data
#
# Path to log files:
#
path.logs: /opt/modules/elasticsearch-2.3.4/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: false
#bootstrap.system_call_filter: false
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
discovery.zen.ping.unicast.hosts: ["xx.xxx.xxx.xxx"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
# elasticsearch plugin ik
index.analysis.analyzer.ik.type: "ik"
elasticsearch - ik分词器安装:
首先上git根据自己的ES版本号下载对应版本的ik。例如ES2.3.4的 https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v1.9.4(这里推荐下载第一个zip,可以省去mvn,当初第一次mvn真的花了很久时间)。
(1)将下载的zip解压缩,获得config文件夹、ik的一个jar文件、一些其他的文件。
config文件夹改名为analysis-ik,放入ES的config中
剩余文件放入ES的plugins目录下的analysis-ik文件夹中(文件夹没有,需要自己创建)。
重要!!!!!!!linux一些环境配置可参见:https://blog.csdn.net/daerzei/article/details/79761086
spring boot 2.x支持elasticsearch >5.x
es安装可参考此博客:https://blog.csdn.net/daerzei/article/details/79761086
分词器可参考:https://blog.csdn.net/u014315200/article/details/78630001
配置文件与上面的大相同,将配置文件最下面的分词器删除掉就行了,删除如下语句
index.analysis.analyzer.ik.type: "ik"
head的安装:
先安装nodejs,然后再安装head
nodejs安装:https://blog.csdn.net/xiatiancc/article/details/78872157
1、下载head插件源码
https://github.com/mobz/elasticsearch-head
由于elasticsearch5.0版本变化较大,目前elasticsearch5.0 暂时不支持直接安装,但是head作者提供了另一种安装方法。