elasticsearch5.5.2 配置 集群

搭建环境全量下载:


下载最新版:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.zip

下载curl工具:https://bintray.com/artifact/download/vszakats/generic/curl-7.55.1-win64-mingw.7z
下载最新IK:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.5.2/elasticsearch-analysis-ik-5.5.2.zip

下载最新Cerebro: https://github.com/lmenezes/cerebro/releases/download/v0.6.6/cerebro-0.6.6.zip


第一个节点:

cluster.name: sunxfCluster
node.name: master
node.master: true
node.data: true
network.host: 127.0.0.1
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
node.max_local_storage_nodes: 2
path.data: E:\\Users\\es\\cluster\\data\\master\\data
path.logs: E:\\Users\\es\\cluster\\data\\master\\logs


第二个节点:

cluster.name: sunxfCluster
node.name: node1
node.master: false
node.data: true
network.host: 127.0.0.1
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
node.max_local_storage_nodes: 2
path.data: E:\\Users\\es\\cluster\\data\\node1\\data
path.logs: E:\\Users\\es\\cluster\\data\\node1\\logs


监控观察: http://127.0.0.1:9000/



显示索引数据:http://127.0.0.1:9200/_cat
集群系列:
   集群状态: http://127.0.0.1:9200/_cluster/health?pretty=true
   显示索引状态:http://127.0.0.1:9200/_cluster/health?pretty=true&level=indices
   显示分片状态:http://127.0.0.1:9200/_cluster/health?pretty=true&level=shards
   集群概况:http://localhost:9200/_cluster/stats?pretty=true
   集群详细信息:http://localhost:9200/_cluster/state?pretty=true
   集群堆积的任务:localhost:9200/_cluster/pending_tasks?pretty=true


查询节点状态:http://localhost:9200/_nodes/stats?pretty=true


索引数据:curl -XPUT localhost:9200/index1/type1/1?pretty -d "{\"name\":\"Fred1\"}"
 curl -XPUT localhost:9200/index1/type1/2?pretty -d "{\"name\":\"Fred2\"}"




获取索引:curl -XGET localhost:9200/index1/type1/1?pretty
 curl -XGET localhost:9200/index1/type1/_search?q=name:Fred"&"pretty
 curl -XGET localhost:9200/index1/type1/_search?q=name:Fred1,Fred2"&"pretty


删除文档:curl -XDELETE localhost:9200/index1/type1/1?pretty

删除索引:curl -XDELETE localhost:9200/index1/type1?pretty


使用IK分词:

1、mapping:

curl -XPOST http://localhost:9200/index3/fulltext/_mapping -d'
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
    
}'

2、post:

curl -XPOST http://localhost:9200/index3/fulltext/1 -d'{"content":"美国留给伊拉克的是个烂摊子吗"}'

3、高亮查询:

curl -XPOST http://localhost:9200/index3/fulltext/_search  -d'
{
    "query" : { "match" : { "content" : "美国" }},
    "highlight" : {
        "pre_tags" : ["", ""],
        "post_tags" : ["
", ""],
        "fields" : {
            "content" : {}
        }
    }
}
'

你可能感兴趣的:(搜索,es集群)