`
donlianli
  • 浏览: 336363 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
Group-logo
Elasticsearch...
浏览量:216616
社区版块
存档分类
最新评论

Elasticsearch升级到1.2(1.x)API的变化-二

阅读更多
本文为官方文档的译文加个人理解。作者翻译时,elasticsearch(下面简称es)的版本为1.2.2。
请支持原创:http://donlianli.iteye.com/blog/2090606
 
一、统计信息相关命令的变化
有关集群状态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
 

二、索引相关api

mapping, alias, settings和warmer相关命令和参数的顺序有所调整。新的顺序及格式如下:
 
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}
 
 
其中{indices},{type}和{name}可以是下面的任意一种:
  • _all* 或者为空,这3种取值意思都一样,代表所有可能的值
  • 通配符,比如“test*
  • 逗号分隔的列表,比如: index_1,test_*
 
唯一的例外就是DELETE命令,这个命令不接收空的值。如果你想删除什么,必须明确指定。
 
同样,Get命令返回的结果也进行了统一。
  1. 只有查询有结果时,才返回具体的值,否则的话,只返回一个空对象{}。当查询的mapping,warmer,alias,setting不存在时,不再返回404
  2. 如果查询到了结果,则结果中总是包含索引名称,然后是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
请支持原创:http://www.iteye.com/blogs/subjects/elasticsearch-tutor
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics