搭建环境全量下载:
下载最新版: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下载最新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/
删除索引: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" : {}
}
}
}
'