Elasticsearch常用命令
=====开始
./bin/elasticsearch
=====停止ֹ
jps | grep Elasticsearch
ps aux | grep elastic
ps -ef|grep kafka
kill -9 15516(进程号)
或者 netstat -ntulp |grep 9200
====给权限
chown -R es:es elasticsearch-6.4.2
=====列出所有索引
curl ‘10.2.5.6:9200/_cat/indices?v’
======logstach 开始
测试配置文件
bin/logstash -f second-pipeline.conf --config.test_and_exit
正式开始
./bin/logstash -f ./config/kafka-logstash-es.conf
=====查看进程
ps -ef|grep logstash
=====REST访问
Elasticsearch使用的端口是9200,可以在浏览器上直接访问http://localhost:9200/ 或者使用curl命令访问http://localhost:9200
curl -XGET ‘http://10.2.5.6:9200’
=====create a index
curl -XPUT http://localhost:9200/index
=====create a mapping
curl -XPOST http://localhost:9200/index/fulltext/_mapping -H ‘Content-Type:application/json’ -d’
{
“properties”: {
“content”: {
“type”: “text”,
“analyzer”: “ik_max_word”,
“search_analyzer”: “ik_max_word”
}
}
}’
=====index some docs
curl -XPOST http://localhost:9200/index/fulltext/1 -H ‘Content-Type:application/json’ -d’
{“content”:“美国留给伊拉克的是个烂摊子吗”}
’
curl -XPOST http://localhost:9200/index/fulltext/2 -H ‘Content-Type:application/json’ -d’
{“content”:“公安部:各地校车将享最高路权”}
’
=====query with highlighting
curl -XPOST http://localhost:9200/index/fulltext/_search -H ‘Content-Type:application/json’ -d’
{
“query” : { “match” : { “content” : “中国” }},
“highlight” : {
“pre_tags” : [\"\", “”],
“post_tags” : [\"\", “”],
“fields” : {
“content” : {}
}
}
}
’
=====测试分词
curl -XGET -H ‘Content-Type: application/json’ ‘http://localhost:9200/_analyze?pretty’ -d ‘{
“analyzer” : “ik_max_word”,
“text”: “小猪佩奇”
}’
/etc/security/limits.conf
-
* soft nofile 65536 -
* hard nofile 131072 -
* soft nproc 4096 -
* hard nproc 4096
/etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
继续阅读与本文标签相同的文章
-
3D打印在玩具行业的应用
2026-05-18栏目: 教程
-
湖北移动誓师第七届世界军人运动会通信保障
2026-05-18栏目: 教程
-
环保新主义:企业无纸化办公
2026-05-18栏目: 教程
-
华能+华为=光伏技术标杆
2026-05-18栏目: 教程
-
淘集集经营模式变更:合伙人自营,主要供应商已成股东合伙人
2026-05-18栏目: 教程
