Elasticsearch从0.90(0.90.x)到1.2(1.x)API的变化-二
本文为官方文档的译文加个人理解。作者翻译时,elasticsearch(下面简称es)的版本为1.2.2。
请支持原创:http://www.cnblogs.com/donlianli/p/3836768.html
一、统计信息相关命令的变化
有关集群状态cluster_state, 节点信息nodes_info, 节点统计信息nodes_stats和索引信息indices_stats命令格式进行了统一,比如查看集群信息使用命令:
curl -XGET http://localhost:9200/_cluster/state/nodes?pretty=1
查看节点统计信息:
curl -XGET http://localhost:9200/_nodes/stats?pretty=1
集群统计信息
curl -XGET http://localhost:9200/_cluster/stats?pretty=1
mapping, alias, settings和warmer相关命令和参数的顺序有所调整。新的顺序及格式如下:
二、索引相关api
curl -XPUT http://localhost:9200/{indices}/_mapping/{type} curl -XPUT http://localhost:9200/{indices}/_alias/{name} curl -XPUT http://localhost:9200/{indices}/_warmer/{name} curl -XGET http://localhost:9200/{indices}/_mapping/{types} curl -XGET http://localhost:9200/{indices}/_alias/{names} curl -XGET http://localhost:9200/{indices}/_settings/{names} curl -XGET http://localhost:9200/{indices}/_warmer/{names} curl -XDELETE http://localhost:9200/{indices}/_mapping/{types} curl -XDELETE http://localhost:9200/{indices}/_alias/{names} curl -XDELETE http://localhost:9200/{indices}/_warmer/{names}
- _all, * 或者为空,这3种取值意思都一样,代表所有可能的值
- 通配符,比如“test*”
- 逗号分隔的列表,比如: index_1,test_*
同样,Get命令返回的结果也进行了统一。
- 只有查询有结果时,才返回具体的值,否则的话,只返回一个空对象{}。当查询的mapping,warmer,alias,setting不存在时,不再返回404。
- 如果查询到了结果,则结果中总是包含索引名称,然后是section,然后是元素名称。例如:
{
"my_index": {
"mappings": {
"my_type": {...}
}
}
}
上面是 get_mapping API返回的结果。
In the future we will also provide plural versions to allow putting multiple mappings etc in a single request.
这句话的意思,好像是在说,可以在一个请求中设置两个版本的mappings。
原文地址:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_stats_and_info_apis.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_indices_apis.html
未完待续......
关于我,邯郸人。
对这类话题感兴趣?欢迎发送邮件至donlianli@126.com
更多elasticsearch介绍,请参考:http://www.iteye.com/blogs/subjects/elasticsearch-tutor
分类:
elasticsearch
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】