美文网首页
es常用命令小结

es常用命令小结

作者: Chting | 来源:发表于2020-06-08 17:07 被阅读0次

查看索引

curl -XGET localhost:9200/_cat
获取所有_cat系列的操作
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
以上的命令中,你也可以后面加一个v,让输出内容表格显示表头

删除索引

curl -X DELETE 'http://server_ip:port/*索引名*'

# 注:新版本es5以后,get获取索引不支持*正则,delete操作支持
# curl -X GET 'http://server_ip:port/*索引名*' 

操作索引

1、获取索引
curl -XGET ‘http://localhost:9200/{index}/{type}/{id}’
2、索引数据
curl -XPOST ‘http://localhost:9200/{index}/{type}/{id}’ -d’{“a”:”avalue”,”b”:”bvalue”}’
3、删除索引
curl -XDELETE ‘http://localhost:9200/{index}/{type}/{id}’
4、设置mapping
curl -XPUT http://localhost:9200/{index}/{type}/_mapping -d ‘{
“{type}” : {
“properties” : {
“date” : {
“type” : “long”
},
“name” : {
“type” : “string”,
“index” : “not_analyzed”
},
“status” : {
“type” : “integer”
},
“type” : {
“type” : “integer”
}
}
}
}’
5、获取mapping
curl -XGET http://localhost:9200/{index}/{type}/_mapping
6、搜索

curl -XGET ‘http://localhost:9200/{index}/{type}/_search’ -d '{
“query” : {
“term” : { “user” : “kimchy” } //查所有 “match_all”: {}
},
“sort” : [{ “age” : {“order” : “asc”}},{ “name” : “desc” } ],
“from”:0,
“size”:100
}
curl -XGET ‘http://localhost:9200/{index}/{type}/_search’ -d '{
“filter”: {“and”:{“filters”:[{“term”:{“age”:“123”}},{“term”:{“name”:“张三”}}]},
“sort” : [{ “age” : {“order” : “asc”}},{ “name” : “desc” } ],
“from”:0,
“size”:100
}

相关文章

  • es常用命令小结

    查看索引 删除索引 操作索引

  • windows常用批处理命令

    Windows批处理(cmd/bat)常用命令小结

  • Mongodb 06-常用命令总结

    ========== 常用命令小结 ========== 选择切换数据库: use articledb 插入数据:...

  • docker 常用命名小结

    docker 常用命令小结 参考 https://docs.docker.com/engine/reference...

  • 2017.11.29. Yu - 日记 - 秋季

    小结 - 写作业,上学,排练。练琴,读书,学习。 明日计划 - 上学。ES Winter Concert。

  • Git&Github入门教程笔记(4)之分支管理一

    八 、分支管理(一) 先列出以此小结常用命令: git branch #查看分支git branch + 名 #创...

  • React-Native之Props(属性)

    效果如下: 小结如下: 1.定义组件的属性类型和默认属性(ES5 和ES6中的区别) 在ES5里,属性类型和默认属...

  • ES6小结

    原文链接 es6中有很多特性,使javascript语法更加丰满,总结一波常用的es6知识点。 1.变量声明con...

  • es6小结

    模板字符串字符串拼接不需要+,而是用``,变量用${变量名}表示 Tips:模板字符串里的变量的值取模板字符串定义...

  • ES6小结

    ES6 javascript 最新版 下面列出常用的一些 声明变量 声明常量 声明对象 箭头函数 小例子 解构 数...

网友评论

      本文标题:es常用命令小结

      本文链接:https://www.haomeiwen.com/subject/swpazhtx.html