首页 > 其他 > 详细

es命令

时间:2020-08-04 16:44:38      阅读:105      评论:0      收藏:0      [点我收藏+]
统计总数:
curl -XGET 127.0.0.1:9200/_cat/indices?v
删除索引
curl -XDELETE ‘127.0.0.1:9200/sfc_product?pretty‘
查询索引结构
curl -XGET ‘http://127.0.0.1:9200/sfc_product?pretty‘
根据_id查找:
curl -XGET ‘localhost:9200/bad_ad_specifics/doc/6406862?pretty‘
查询所有:
curl -XGET ‘127.0.0.1:9200/bad_advt_detail/doc/_search?q=*&pretty‘
分页查询:
curl -H "Content-Type: application/json" -XGET 127.0.0.1:9200/badword/doc/_search?pretty -d‘{"query": { "match": {"category_id" : "4929"} },"from": 1,"size": 5}‘
条件查询-json:
curl -H "Content-Type: application/json" -XGET 127.0.0.1:9200/bad_advt_title/doc/_search?pretty -d‘{"query": { "match": {"id" : "4019349"} }}‘
条件查询-参数:
curl -d "name=Dual USB Socket Charger Adapter For Ipod Nano&categoryId=4928" "http://127.0.0.1:8801/shopeeProduct/similarSearch"
创建索引
curl -H "Content-Type: application/json" -XPUT ‘localhost:9200/demo?pretty‘ -d ‘{"mappings": {"doc":{"properties":{"ad_id":{"type":"keyword","store":false,"index":"true"},"ad_detail_description":{"type":"text","store":false,"index":"true"}}}}}‘
curl -H "Content-Type: application/json" -XPUT ‘localhost:9200/aaa?pretty‘ -d ‘{"settings": {"analysis": {"analyzer": {"caseSensitive": {"filter": "lowercase","type": "custom","tokenizer": "keyword"}}}}}‘
查询
curl -XPOST http://127.0.0.1:8801/badword/get/all -d ‘adSite=US&text=easy reach&pageSize=1000&pageNum=1‘
curl http://127.0.0.1:8801/shopeeProduct/get/similar?name=Football Kick Trainer Skills Solo&companyId=1&siteCode=Shopee.Toyfulcabin.my
curl -H "Content-Type: application/json" -XPOST http://127.0.0.1:8801/badword/get/all -d ‘{"adSite":"UK","text":"French Fries"}‘
 
删除
curl -XDELETE ‘localhost:9200/bad_advt_title?pretty‘
定义父子关系
curl -H "Content-Type: application/json" -XPUT "http://localhost:9200/bad_word?pretty" -d ‘{"mappings": { "bad_advt_title" : {"properties":{"ad_id":{"type":"integer","store":false,"index":"true"},"ad_site":{"type":"keyword","store":false,"index":"true"},"ad_status":{"type":"integer","store":false,"index":"true"},"ad_title":{"type":"text","store":false,"index":"true"},"ad_description":{"type":"text","store":false,"index":"true"},"ad_detail_description":{"type":"text","store":false,"index":"true"},"ads_id":{"type":"integer","store":false,"index":"true"},"ads_specifics_name":{"type":"text","store":false,"index":"true"},"ads_specifics_value":{"type":"text","store":false,"index":"true"}}},"bad_advt_detail":{"_parent": {"type": "bad_advt_title"}},"bad_ad_specifics":{"_parent": {"type": "bad_advt_title"}}}}‘
curl -XDELETE ‘localhost:9200/bad_word?pretty‘
设置最大返回条数
curl -H "Content-Type: application/json" -XPUT http://127.0.0.1:9200/bad_advt_title/_settings -d ‘{"index": {"max_result_window": 1000000}}‘
indices.query.bool.max_clause_count: 200000
 
启动elasticsearch
1.切换到目录
cd /home/elsearch/elasticsearch-6.5.4
cd /mnt/disk1/es/elasticsearch-6.5.4
 
2.切换elsearch用户
su elsearch
 
3.启动
./bin/elasticsearch -d
 
启动logstash
1.切换到目录(root用户):
cd /opt/logstash-6.5.4
cd /usr/elk/logstash
2.后台启动某个文件
nohup ./bin/logstash -f ./es_config/conf/logstash.conf &
(运行某个文件下所有文件:)
nohup ./bin/logstash -f ./es_config/conf &
3.查看日志
tail -f nohup.out

 

es命令

原文:https://www.cnblogs.com/xylx2011/p/12679094.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!