elasticsearch命令简单介绍
来源:互联网 发布:嵌入式linux开发前景 编辑:程序博客网 时间:2024/06/06 13:21
1..创建一个customer索引
PUT /customer?pretty
2. GET /_cat/indices?v 查看所有的索引
3. 当我们询问集群状态的时候,我们要么得到绿色、黄色或红色。绿色代表一切正常(集群功能齐全),黄色意味着所有的数据都是可用的,但是某些复制没有被分配(集群功能齐全),红色则代表因为某些原因,某些数据不可用。注意,即使是集群状态是红色的,集群仍然是部分可用的(它仍然会利用可用的分片来响应搜索请求),但是可能你需要尽快修复它,因为你有丢失的数据。
4. PUT /customer/mytype/1
{
"name": "John Doe"
}
创建customer索引并在其中创建mytype数据库,然后指定创建的索引为1
PUT创建的时候一定要指定id,POST创建的时候可以自动生成Id
5.DELETE /customer
删除customer索引
6.pretty 参数 代表结果为格式化之后的json数据
7.human参数 代表结果为处理过的适合人类阅读的数据
8. GET /customer/logs/_search?scroll=10m 查询所有的数据
1. POST /customer/_close 关闭索引 关闭的索引只能显示索引元数据信息,不能进行读写
2. POST /customer/_open 开启索引
3. 配置action.destructive_requires_name 为true 禁止使用通配符或者_all标识索引,使用_all可以控制索引全部打开或者关闭。关闭的索引会继续占用磁盘空间而不能使用,所以会造成磁盘空间的浪费
4. 设置settingscluster.indices.close,enable为false 禁用关闭索引功能,默认为true
5. GET _mapping 获取所有的索引结构
6. GET /_all/_mapping 同5 ,两者是一样的,_all可以忽略
7. GET /customer15/_mapping/field/aaa 返回索引为customer15中字段为aaa的值
8. HEAD customer100 检查某个索引是否存在,存在返回200,否则返回404
9. PUT /customer/_alias/aa 给customer索引添加别名,一个别名可以对应多个索引,一个索引也可以有多个别名
10. DELETE customer1/_alias/aa 删除索引的别名
11. PUT customer/_settings
{
"index":{"number_of_shards":3}
}
12. GET /_template 获取所有的索引模板
13.HEAD /_template/template_1 判断模板是否存在
14.如果数据满足两个模板,那么会合并两个模板的配置,如果配置重复,这时应该设置order属性,order从0开始,先匹配数字小的,再匹配数字大的,如果有相同的配置,后匹配的会覆盖之前的配置
15. PUT customer/_settings
{
"analysis":{
"analyzer":{
"content":{"type":"custom","tokenizer":"whitespace"}
}
}
} 添加空格分词器
16. GET /customer/_settings 查看分词器
17.GET /_stats 获取所有聚合以及索引的统计数据
18.GET/customer/_segments 获取customer的分片信息
19.POST customer/_cache/clear清除索引的缓存
20.POST /_forcemerge 索引合并
21.自动创建索引,字段类型很灵活,可以通过index.maper.dynamic =false 禁用自动创建,自动创建索引也可以通过模板设置索引名字:action.auto_create_index 为 +aaa*,-bbb*,-*,(+表示准许,-表示禁止)
22. POST /iktest/article/_bulk?pretty
{ "index" : { "_id" : "3" } }
{"subject" : "媒体称FBI已经取得搜查令 检视希拉里电邮" }
{ "index" : { "_id" : "4" } }
{"subject" : "村上春树获安徒生奖 演讲中谈及欧洲排外问题" }
{ "index" : { "_id" : "5" } }
{"subject" : "希拉里团队炮轰FBI 参院民主党领袖批其“违法”" } 批量插入数据
23.PUT /_template/template-log -d '/home/elsearch/elasticsearch-5.5.0/data/template-tss-log.json' 导入模板
- elasticsearch命令简单介绍
- Elasticsearch的简单介绍
- ElasticSearch的简单介绍
- elasticsearch学习步骤01--------简单介绍
- ElasticSearch之——配置文件简单介绍
- linux命令简单介绍
- mongo命令简单介绍
- 简单介绍maven命令
- AT命令简单介绍
- Elasticsearch介绍
- elasticsearch命令
- elasticsearch 命令
- Elasticsearch简单使用系列--详细介绍ES的核心概念
- linux 命令的简单介绍
- Centos7 systemctl命令简单介绍
- zabbix通过简单shell命令监控elasticsearch集群状态
- Elasticsearch 单机简单安装及常用查询命令
- elasticsearch中template介绍
- IDEA 热部署 Tomcat
- COOP绕过微软最新CFG(Control Flow Guard)
- Object-c学习笔记
- malloc
- 多线程的那些事
- elasticsearch命令简单介绍
- Hadoop之Zookeeper
- pyhton利用classname定位
- 仿今日头条视频播放JieCaoVideoPlayer
- javascript解决for循环中i取值的问题
- Activiti工作流节点的自由跳转
- rpath-link和rpath使用
- 摄像头常用接口
- Java day14-15