查看集群状态
| |
| curl http://*:9200/_cluster/health?pretty |
| |
| |
| curl http://*:9200/_nodes/stats?pretty |
| |
| |
| curl http://*:9200/_cat/indices?pretty |
| |
| |
| curl http://*:9200/_cat/indices?v&health=red |
| |
| |
| curl http://*:9200/_cat/shards/my_index?v |
| |
| |
| curl http://*:9200/_cat/shards/my_index?v&h=n,index,shard,prirep,state,sto,sc,unassigned.reason,unassigned.details |
| |
| |
| curl -XPOST http://*:9200/_cluster/reroute?retry_failed=true |
查看配置
| curl http://*:9200/_cluster/settings |
| |
| |
| |
| curl http://*:9200/your_index/_settings |
修改配置
| |
| curl -XPUT http://*:9200/*/_settings -H 'Content-Type:application/json' -d '{"index":{"numer_of_replicas":0}}' |
| |
| |
| curl -XPUT http://*:9200/_cluster/settings -H 'Content-Type:application/json' -d '{"persistent":{"search.max_open_scroll_context":5000},"transient":{"search.max_open_scroll_context":5000}}' |
| |
| |
| curl -XPUT http://*:9200/_all/_settings -H "Content-Type: application/json" -d '{"index.blocks.read_only_allow_delete": false}' |
查询数据
kibana操作
| GET _search |
| { |
| "query": { |
| "match_all": {} |
| } |
| } |
| |
| GET _cat/nodes |
| GET _cat/health |
| GET _cat/master |
| GET _cat/indices |
| GET _cat/indices?v |
| |
| |
| PUT /customer/_doc/6 |
| { |
| "name":"Haha" |
| } |
| |
| |
| GET /customer/_doc/6 |
| GET /customer |
| |
| |
| POST customer/_update/6/ |
| { |
| "doc":{ |
| "name":"Jane", |
| "age":19 |
| } |
| } |
| |
| |
| DELETE customer/_doc/5 |
| |
| DELETE customer |
| DELETE bank |
| |
| GET bank/_doc/1 |
| PUT /bank/_doc/_bulk |
| |
| |
| |
| |
| GET customer/_doc/1 |
| PUT /customer/_bulk |
| {"index":{"_id":"1"}} |
| {"name":"John Doe"} |
| {"index":{"_id":"2"}} |
| {"name":"Jane"} |
| |
| |
| PUT /_bulk |
| {"delete":{"_index":"webset","_id":"123"}} |
| {"create":{"_index":"webset","_id":"123"}} |
| {"title":"My first blog post"} |
| {"index":{"_index":"webset"}} |
| {"title":"My second blog post"} |
| {"update":{"_index":"webset","_id":"123"}} |
| {"doc":{"title":"My updateed blok post"}} |
| |
| GET _cat/indices?v |
| DELETE bank |
| |
| |
| GET bank/_search?q=*&sort=account_number:desc |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_all": {} |
| }, |
| "sort": [ |
| { |
| "account_number": "desc" |
| }, |
| { |
| "balance": "desc" |
| } |
| ] |
| } |
| |
| GET / |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_all": {} |
| }, |
| "sort": [ |
| { |
| "account_number": { |
| "order": "desc" |
| } |
| } |
| ] |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "match": { |
| "address": "mill lane" |
| } |
| } |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_phrase": { |
| "address": "mill lane" |
| } |
| } |
| } |
| |
| GET bank/_search |
| { |
| "query": { |
| "multi_match": { |
| "query": "mill Movico", |
| "fields": ["address", "city"] |
| } |
| } |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "bool": { |
| "must": [ |
| {"match": { |
| "gender": "M" |
| }}, |
| { |
| "match": { |
| "address": "mill" |
| } |
| } |
| ], |
| "must_not": [ |
| {"match": { |
| "age": 28 |
| }} |
| ], |
| "should": [ |
| {"match": { |
| "lastname": "Holland" |
| }} |
| ] |
| } |
| } |
| } |
| |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "bool": { |
| "must": [ |
| {"range": { |
| "age": { |
| "gte": 18, |
| "lte": 30 |
| } |
| }} |
| ] |
| } |
| } |
| } |
| |
| GET bank/_search |
| { |
| "query": { |
| "bool": { |
| "filter": [ |
| {"range": { |
| "age": { |
| "gte": 18, |
| "lte": 30 |
| } |
| }} |
| ] |
| } |
| } |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "term": { |
| "age":28 |
| } |
| } |
| } |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_phrase": { |
| "address": "mill lane" |
| } |
| } |
| } |
| |
| GET bank/_search |
| { |
| "query": { |
| "match": { |
| "address.keyword": "198 Mill Lane" |
| } |
| } |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "match": { |
| "address": "mill" |
| } |
| }, |
| "aggs": { |
| "ageAgg": { |
| "terms": { |
| "field": "age", |
| "size": 10 |
| } |
| }, |
| "ageAvg":{ |
| "avg": { |
| "field": "age" |
| } |
| }, |
| "balanceAvg":{ |
| "avg": { |
| "field": "balance" |
| } |
| } |
| }, |
| "size": 0 |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_all": {} |
| }, |
| "aggs": { |
| "ageAgg": { |
| "terms": { |
| "field": "age", |
| "size": 100 |
| }, |
| "aggs": { |
| "ageAvg": { |
| "avg": { |
| "field": "age" |
| } |
| }, |
| "balanceAvg":{ |
| "avg": { |
| "field": "balance" |
| } |
| } |
| } |
| } |
| }, |
| "size": 0 |
| } |
| |
| |
| GET bank/_search |
| { |
| "query": { |
| "match_all": {} |
| }, |
| "aggs": { |
| "ageAgg": { |
| "terms": { |
| "field": "age", |
| "size": 100 |
| }, |
| "aggs": { |
| "balanceAvg": { |
| "avg": { |
| "field": "balance" |
| } |
| }, |
| "genderAgg": { |
| "terms": { |
| "field": "gender.keyword", |
| "size": 10 |
| }, |
| "aggs": { |
| "balanceAvg": { |
| "avg": { |
| "field": "balance" |
| } |
| } |
| } |
| } |
| } |
| } |
| }, |
| "size": 0 |
| } |
| |
| |
| |
| GET bank/_mapping |
| DELETE my_index |
| |
| PUT my_index |
| { |
| "mappings": { |
| "properties": { |
| "age":{"type": "integer"}, |
| "email":{"type": "keyword"}, |
| "name":{"type": "text","index": true} |
| } |
| } |
| } |
| GET my_index/ |
| |
| PUT my_index/_mapping |
| { |
| "properties":{ |
| "employee_id": { |
| "type":"keyword", |
| "index":"false" |
| } |
| } |
| } |
| DELETE my_index |
| |
| GET bank/_mapping |
| |
| PUT newbank |
| { |
| "mappings": { |
| "properties": { |
| "account_number": { |
| "type": "long" |
| }, |
| "address": { |
| "type": "text" |
| }, |
| "age": { |
| "type": "integer" |
| }, |
| "balance": { |
| "type": "long" |
| }, |
| "city": { |
| "type": "keyword" |
| }, |
| "email": { |
| "type": "keyword" |
| }, |
| "employer": { |
| "type": "keyword" |
| }, |
| "firstname": { |
| "type": "keyword" |
| }, |
| "gender": { |
| "type": "keyword" |
| }, |
| "lastname": { |
| "type": "keyword" |
| }, |
| "state": { |
| "type": "text" |
| } |
| } |
| } |
| } |
| GET bank/_search |
| |
| POST _reindex |
| { |
| "source": { |
| "index": "bank" |
| }, |
| "dest": { |
| "index": "newbank" |
| } |
| } |
| |
| GET newbank/_search |
| |
| |
| POST _analyze |
| { |
| "analyzer": "standard", |
| "text": ["hello你好"] |
| } |
| |
| POST _analyze |
| { |
| "analyzer": "ik_smart", |
| "text": ["我是中国人"] |
| } |
| POST _analyze |
| { |
| "analyzer": "ik_max_word", |
| "text": ["我是中国人"] |
| } |
| |
| POST _analyze |
| { |
| "analyzer": "ik_smart", |
| "text": ["乔碧萝殿下天大我地大"] |
| } |
| |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~