elasticsearch 常用接口

本文档提供Elasticsearch2.3.4版本中常用的命令操作指南,包括集群状态查看、节点信息查询、索引管理、统计信息获取、线程池配置检查等功能。适用于运维人员和技术支持团队日常管理和故障排查。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

elasticsearch 2.3.4-常用命令

功能命令
查看集群状态curl -XGET ‘http://localhost:9200/_cluster/health?pretty
列出节点信息curl -XGET ‘http://localhost:9200/_cat/nodes?v
列出索引信息curl -XGET ‘http://localhost:9200/_cat/indices?v
列出分片信息curl -XGET ‘http://localhost:9200/_cat/shards?v
查看进程信息curl -XGET ‘http://localhost:9200/_nodes/process?pretty
获取统计信息curl -XGET ‘http://localhost:9200/_stats?pretty
获取统计信息-执行索引curl -XGET ‘http://localhost:9200/productindex/_stats?pretty
热点线程curl -XGET ‘http://localhost:9200/_nodes/hot_threads?pretty
每10sdump热点线程curl -XGET ‘http://localhost:9200/_nodes/hot_threads?type=cpu&interval=10s
获取索引信息curl -XGET ‘http://localhost:9200/productindex/_mapping?pretty
获取JVM信息curl -XGET “http://localhost:9200/_nodes/stats/jvm?pretty
获取JVM信息-指定节点curl -XGET “http://localhost:9200/_nodes/yoho.node.114/stats/jvm?pretty
删除全部索引curl -XDELETE ‘http://localhost:9200/*?pretty’
删除指定索引curl -XDELETE ‘http://localhost:9200/storagesku?pretty
查看段信息curl -XGET ‘http://localhost:9200/productindex/_segments
执行段合并curl -XPOST ‘http://localhost:9200/productindex/_forcemerge?max_num_segments=1
查看线程池配置curl -XGET “http://localhost:9200/_nodes/thread_pool/
要在Elasticsearch中添加接口,你可以使用Elasticsearch的REST API。通过REST API,你可以执行各种操作,包括索引文档、搜索、更新和删除等。 首先,确保你已经安装并启动了Elasticsearch。你可以按照引用\[2\]中提供的步骤来安装和启动Elasticsearch。 接下来,你可以使用curl或任何其他HTTP客户端来发送HTTP请求来与Elasticsearch进行交互。以下是一个示例使用curl发送POST请求来索引一个文档的接口: ``` curl -XPOST "http://localhost:9200/index_name/_doc" -H 'Content-Type: application/json' -d' { "field1": "value1", "field2": "value2" } ' ``` 在上面的示例中,你需要将`index_name`替换为你要索引的索引名称,`field1`和`field2`替换为你的文档字段和对应的值。 你还可以使用其他HTTP方法,如GET、PUT和DELETE来执行其他操作,例如搜索、更新和删除文档。你可以参考引用\[1\]中的官方文档了解更多关于Elasticsearch的REST API的详细信息。 总结起来,要在Elasticsearch中添加接口,你需要使用Elasticsearch的REST API来发送HTTP请求,并根据你的需求执行相应的操作。 #### 引用[.reference_title] - *1* *2* *3* [【搜索引擎】elasticsearch入门到进阶 - 常用接口](https://blog.youkuaiyun.com/the_shy_faker/article/details/128520129)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值