Elasticsearch-PHP 命名空间
来源:互联网 发布:js 浏览新闻 不刷新 编辑:程序博客网 时间:2024/06/06 16:40
命名空间
客户端有很多命名空间,通常能够暴漏出他管理的功能。命名空间对应Elasticsearch各种管理的端点。如下是完成的命名空间的列表:
cluster()以集群为中心的统计数据和信息
snapshot()快照/还原您的集群和指示器的方法
cat()访问Cat API(这是通常用于的独立从命令行访问)
有些方法可以在不同的命名空间下使用,给你相同的信息,但是分组到不同的上下文。如果要查看这些命名空间是如何工作的,让我们来看看_stats的输出:
$client = new Elasticsearch\Client();// Index Stats// Corresponds to curl -XGET localhost:9200/_stats$response = $client->indices()->stats();// Node Stats// Corresponds to curl -XGET localhost:9200/_nodes/stats$response = $client->nodes()->stats();// Cluster Stats// Corresponds to curl -XGET localhost:9200/_cluster/stats$response = $client->cluster()->stats();
正如你所看到的,同样的 stats() 调用在三个不同的命名空间。有时候方法需要参数。这些参数的工作原理就像其它库中的方法一样。
例如我们可以请求一个特定的索引或多个索引信息的统计。
$client = new Elasticsearch\Client();// Corresponds to curl -XGET localhost:9200/my_index/_stats$params['index'] = 'my_index';$response = $client->indices()->stats($params);// Corresponds to curl -XGET localhost:9200/my_index1,my_index2/_stats$params['index'] = array('my_index1', 'my_index2');$response = $client->indices()->stats($params);
另一个例子,如何在现有索引中添加一个别名。
$params['body'] = array( 'actions' => array( array( 'add' => array( 'index' => 'myindex', 'alias' => 'myalias' ) ) ));$client->indices()->updateAliases($params);
请注意 stats 调用和 updateAlias 是如何接受一个多样化的参数,每一个都是根据特定API的需要。stats API仅仅需要一个索引名称,然而 updateAlias 需要一个body上的动作。
0 0
- Elasticsearch-PHP 命名空间
- PHP手册-命名空间
- PHP手册-命名空间
- PHP的命名空间
- php命名空间 namespace
- PHP的命名空间
- php 命名空间
- PHP命名空间
- php 命名空间1
- php命名空间2
- PHP中的命名空间
- php 命名空间
- PHP 命名空间 入门
- PHP命名空间
- php命名空间
- PHP中的命名空间
- php namespace-命名空间
- PHP中的命名空间
- Android创建指定大小、类型的文件
- ImageView 设置图片
- windows如何往github上传项目
- React Native实战(一):MAC配置环境
- Gradle笔记——构建基础
- Elasticsearch-PHP 命名空间
- MySQL index hint
- Android 批量插入联系人 分享
- Framebuffer and rendering
- Eclipse 常用快捷键
- Android 之屏幕全屏、去掉标题栏
- 使用WinRar将Qt编译生成的exe和依赖的dll文件打包为一个exe文件的简单方法
- win操作系统密码破解
- HBase总结(十二)Java API 与HBase交互实例