elasticsearsh常用命令

elasticsearch

查询所有文档:

curl -XGET 'http://192.168.1.34:9200/_search?pretty'

按索引查询所有文档:

curl -XGET 'http://192.168.1.34:9200/{index_name}/_search?pretty'

按条件查询文档:

curl -XGET 'http://192.168.1.34:9200/{index_name}/_search?q={field_name}:{search_query}&pretty'

使用查询DSL查询文档:

curl -XGET 'http://192.168.1.34:9200:9200/{index_name}/_search?pretty' -H 'Content-Type: application/json' -d '{"query": {"match": {"field_name": "search_query"}}}'

其中,{index_name}是要查询的索引名称,{field_name}是要查询的字段名称,{search_query}是要搜索的关键字或短语。在第4个示例中,查询DSL被包含在HTTP请求正文中,可以使用-d选项指定。

获取 Elasticsearch 中所有索引的名称和总数:

curl -XGET 'http://localhost:9200/_cat/indices

查看集群快照信息

curl -XGET 'http://192.168.1.34:9200/_snapshot?pretty'

删除elasticsearch索引命令

实例删除appfac_history_b81ab1497ae1133dbc41e584912d77aa

curl -X DELETE "http://10.50.11.131:9200/appfac_history_b81ab1497ae1133dbc41e584912d77aa" -H 'Content-Type: application/json' -u elastic:S3dp7hDm

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值