elasticsearch常用命令
curl -X<REST Verb> <Node>:<Port>/<Index>/<Type>/<ID>
1、启动
[es@vm1 bin]$ ./elasticsearch --cluster.name myes --node.name node1
- [es@vm1 ~]$ curl http://vm1:9200/_cat/health?v
- epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks
- 1432704777 22:32:57 myes green
[es@vm1 ~]$ curl http://vm1:9200/_cat/nodes?v
host ip heap.percent ram.percent load node.role master name
vm1 192.168.1.111 3 24 0.04 d * node1
[es@vm1 ~]$ curl http://vm1:9200/_cat/indices?v
health status index pri rep docs.count docs.deleted store.size pri.store.size
[es@vm1 ~]$ curl -XPUT http://vm1:9200/customer?pretty
{
"acknowledged" : true
}
[es@vm1 ~]$ curl -XPUT vm1:9200/customer/external/1?pretty -d '{"name":"lisg"}'
{
"_index" : "customer",
"_type" : "external",
"_id" : "1",
"_version" : 4,
"created" : true
}
[es@vm1 ~]$ curl -XGET vm1:9200/customer/external/1?pretty
{
"_index" : "customer",
"_type" : "external",
"_id" : "1",
"_version" : 4,
"found" : true,
"_source":{"name":"lisg"}
}
[es@vm1 ~]$ curl -XDELETE vm1:9200/customer/external/1?pretty
{
"found" : true,
"_index" : "customer",
"_type" : "external",
"_id" : "1",
"_version" : 5
}
[es@vm1 ~]$ curl -XDELETE vm1:9200/customer/external?pretty
{
"acknowledged" : true
}
[es@vm1 ~]$ curl -XDELETE vm1:9200/customer?pretty
{
"acknowledged" : true
}
[es@vm1 ~]$ curl -XPOST vm1:9200/customer/external?pretty -d '{"name":"zhangsan"}'
{
"_index" : "customer",
"_type" : "external",
"_id" : "AU2UAazzBzlrcKeIwh7T",
"_version" : 1,
"created" : true
}
[es@vm1 ~]$ curl -XPOST vm1:9200/customer/external/_bulk?pretty -d '
> {index:{_id:3}}
> {name:"zhangsan", age:28}
> {index:{_id:4}}
> {name:"lisi", age:29}
> {update:{_id:4}}
> {doc:{name:"lisi2", age:30}}
> {delete:{_id:"AU2UAazzBzlrcKeIwh7T"}}
> '
{
"took" : 34,
"errors" : false,
"items" : [ {
"index" : {
"_index" : "customer",
"_type" : "external",
"_id" : "3",
"_version" : 1,
"status" : 201
}
}, {
"index" : {
"_index" : "customer",
"_type" : "external",
"_id" : "4",
"_version" : 1,
"status" : 201
}
}, {
"update" : {
"_index" : "customer",
"_type" : "external",
"_id" : "4",
"_version" : 2,
"status" : 200
}
}, {
"delete" : {
"_index" : "customer",
"_type" : "external",
"_id" : "AU2UAazzBzlrcKeIwh7T",
"_version" : 2,
"status" : 200,
"found" : true
}
} ]
}
[es@vm1 ~]$ curl -XPOST http://vm1:9200/customer/external/_bulk?pretty --data-binary @accounts.json
[es@vm1 ~]$ curl -XGET vm1:9200/_cat/indices?v
health status index pri rep docs.count docs.deleted store.size pri.store.size
yellow open customer 5 1 1000 0 442.3kb 442.3kb
附件列表
elasticsearch常用命令的更多相关文章
- elasticsearch 常用命令
#查看集群状态 curl -XGET "http://localhost:9200/_cluster/health?pretty" #查看所有的快照 curl -XGET &quo ...
- 实战ELK(2) ElasticSearch 常用命令
1.Cluster Health 集群状态 curl 'localhost:9200/_cat/health?v' yellow代表分片副本确实,因为我们现在只有一台机器. curl 'localho ...
- elasticsearch 常用命令(一)
索引 搜索 mapping 分词器 1.创建索引 http://192.168.65.131:9200/smartom_index?pretty 2.查看索引: http://192.168.65.1 ...
- elasticsearch 常用命令 一直红色 重启不稳定 不停的宕机
persistent (重启后设置也会存在) or transient (整个集群重启后会消失的设置). 查看集群状态和每个indices状态.搜索到red的,没用就删除 GET /_cluster/ ...
- ElasticSearch——常用命令
集群相关 --查询集群健康状态 GET _cluster/health --查询所有节点 GET _cat/nodes --查询索引及分片的分布 GET _cat/shards --查询指定索引分片的 ...
- elasticsearch常用命令备注
1.检查集群健康状态 curl 'localhost:9200/_cat/health?v' 2.检查节点健康状态 curl 'localhost:9200/_cat/nodes?v' 3.新增一条索 ...
- elasticsearch(四) 之 elasticsearch常用的一些集群命令
目录 elasticsearch常用的一些集群命令 查看集群健康状态 查看集群的节点列表 查看所有的索引 删除索引 查询索引的某个文档内容 更新文档 删除文档 自动创建索引 定时删除索引 elasti ...
- elasticsearch 索引清理脚本及常用命令
elastic索引日志清理不及时,很容易产生磁盘紧张,官网给出curl -k -XDELETE可以清理不需要的索引日志. 清理脚本 #!/bin/bash #Author: 648403020@qq. ...
- Docker安装和常用命令
Docker安装 Docker的安装可以参考 https://docs.docker.com/ 下面的 Get Docker / Docker CE / Linux, 需要关注的主要是CentOS和U ...
随机推荐
- [Swift]LeetCode67. 二进制求和 | Add Binary
Given two binary strings, return their sum (also a binary string). The input strings are both non-em ...
- [Swift]LeetCode124. 二叉树中的最大路径和 | Binary Tree Maximum Path Sum
Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any ...
- [Swift]LeetCode417. 太平洋大西洋水流问题 | Pacific Atlantic Water Flow
Given an m x n matrix of non-negative integers representing the height of each unit cell in a contin ...
- 使用Task
http://www.cnblogs.com/Charltsing/p/taskpoolthread.html task默认对线程的调度是逐步增加的,连续多次运行并发线程,会提高占用的线程数,而等若干 ...
- Ubuntu12.04下安ns-3.29及Ubuntu换源方法
目录 1.下载ns-3.29 2.安装gcc-4.9.2 3.编译.测试ns-3.29 第一种:更新,文章开头说的 第二种,更新源 主机型号:Ubuntu12.04 仿真环境版本:NS-3.29 安装 ...
- Thrift 代码分析
Thrift的基本结束 Thrift是一个跨语言的服务部署框架,最初由Facebook于2007年开发,2008年进入Apache开源项目.Thrift通过IDL(Interface Definiti ...
- Netty浅析
Netty是JBoss出品的高效的Java NIO开发框架,关于其使用,可参考我的另一篇文章 netty使用初步.本文将主要分析Netty实现方面的东西,由于精力有限,本人并没有对其源码做了极细致的研 ...
- Android--Tween补间动画
前言 Android除了支持逐帧动画之外,也提供了对补间动画的支持,补间动画就是指开发人员只需要指定动画的开始.动画结束的"关键帧",而动画变化的"中间帧"由系 ...
- Kafka并不难学
1.为什么写这本书? 我建立了一个qq群,有很多人在群里面学习和交流,经常有人问我一些Kafka的知识,我可以感受他们对技术的热情,这是一群刚走出校门,或者工作经验较少,又或是一些转型的开发新人,他们 ...
- Java开发知识之Java的枚举
Java开发知识之Java的枚举 一丶什么是枚举 枚举可以理解为就是常量,在Java中我们定义常量.都是用 final语句. C++中都是用const关键字. 枚举跟C++概念都是一样的.就是特定的常 ...