Skip to content

Commit

Permalink
Merge pull request elastic#14 from zhuan77241/chapter/chapter12/cat.a…
Browse files Browse the repository at this point in the history
…sciidoc

Chapter/chapter12/cat.asciidoc 翻译完成
  • Loading branch information
zhuan77241 authored Nov 23, 2018
2 parents 816e6f6 + e1714ff commit dcd4667
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 320 deletions.
95 changes: 42 additions & 53 deletions docs/reference/cat.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,30 @@
["float",id="intro"]
== Introduction

JSON is great... for computers. Even if it's pretty-printed, trying
to find relationships in the data is tedious. Human eyes, especially
when looking at an ssh terminal, need compact and aligned text. The
cat API aims to meet this need.
对于计算机来说,JSON 是一种很好的格式,虽然它便于打印,但是尝试找出潜在的数据关系是比较麻烦的。
对于人眼,特别是在看 ssh 终端时,需要紧凑和对齐的文本。
cat API 旨在满足这一需求。

All the cat commands accept a query string parameter `help` to see all
the headers and info they provide, and the `/_cat` command alone lists all
the available commands.
所有的 cat 命令都接受一个字符串参数 `help` 来查看全部。
它们提供了头部(headers)和其它信息,以及单独的 `/_cat` 命令列出了所有可用的命令。

[float]
[[common-parameters]]
== Common parameters
== 常用参数

[float]
[[verbose]]
=== Verbose
=== 详细

Each of the commands accepts a query string parameter `v` to turn on
verbose output. For example:
每个命令接受一个查询字符串参数 `v` 打开详细输出。 例如:

[source,js]
--------------------------------------------------
GET /_cat/master?v
--------------------------------------------------
// CONSOLE

Might respond with:
可能响应:

[source,txt]
--------------------------------------------------
Expand All @@ -44,18 +41,17 @@ u_n93zwxThWHi1PDBJAGAg 127.0.0.1 127.0.0.1 u_n93zw

[float]
[[help]]
=== Help
=== 帮助

Each of the commands accepts a query string parameter `help` which will
output its available columns. For example:
每个命令都接受一个字符串参数 `help` ,它将会输出其可用列。 例如:

[source,js]
--------------------------------------------------
GET /_cat/master?help
--------------------------------------------------
// CONSOLE

Might respond with:
可能响应:

[source,txt]
--------------------------------------------------
Expand All @@ -73,45 +69,39 @@ instead.

[float]
[[headers]]
=== Headers
=== 头部

Each of the commands accepts a query string parameter `h` which forces
only those columns to appear. For example:
每个命令接受字符串参数 `h` 强制显示指定列。 例如:

[source,js]
--------------------------------------------------
GET /_cat/nodes?h=ip,port,heapPercent,name
--------------------------------------------------
// CONSOLE

Responds with:
响应:

[source,txt]
--------------------------------------------------
127.0.0.1 9300 27 sLBaIGK
--------------------------------------------------
// TESTRESPONSE[s/9300 27 sLBaIGK/\\d+ \\d+ .+/ _cat]

You can also request multiple columns using simple wildcards like
`/_cat/thread_pool?h=ip,queue*` to get all headers (or aliases) starting
with `queue`.
你也可以使用简单的通配符来请求多个列 `/_cat/thread_pool?h=ip,queue.*`
获取所有头部(或别名)以 `queue.` 开头。

[float]
[[numeric-formats]]
=== Numeric formats
=== 数字格式

Many commands provide a few types of numeric output, either a byte, size
or a time value. By default, these types are human-formatted,
for example, `3.5mb` instead of `3763212`. The human values are not
sortable numerically, so in order to operate on these values where
order is important, you can change it.
许多命令提供几种类型的数字输出,字节,大小或时间。
默认情况下,这些类型是对人类友好的 (human-formatted),例如, `3.5mb` 而不是 `3763212` 。
这些人类可读的值无法以数值排序,所以为了操作这些在顺序上很重要的数值,你可以改变它。

Say you want to find the largest index in your cluster (storage used
by all the shards, not number of documents). The `/_cat/indices` API
is ideal. We only need to tweak two things. First, we want to turn
off human mode. We'll use a byte-level resolution. Then we'll pipe
our output into `sort` using the appropriate column, which in this
case is the eighth one.
假设你想要查找群集中的最大索引(所有分片使用的存储空间,而不是文档数量)。
`/_cat/indices` API 是理想的。我们只需要调整两件事。
首先,我们要关闭 human 模式。我们将使用字节级别的分辨率。
然后,我们使用适当的列将输出结果用管道输入到 `sort` 中,在这个例子中是第八列。

[source,sh]
--------------------------------------------------
Expand All @@ -122,14 +112,14 @@ green foo 1 0 227 0 2065131 2065131
--------------------------------------------------
// NOTCONSOLE

If you want to change the <<time-units,time units>>, use `time` parameter.
如果你要更改 <<time-units,time units>>,请使用 `time` 参数。

If you want to change the <<size-units,size units>>, use `size` parameter.
如果你要更改 <<size-units,size units>>,请使用 `size` 参数。

If you want to change the <<byte-units,byte units>>, use `bytes` parameter.
如果你要更改 <<byte-units,byte units>>,请使用 `bytes` 参数。

[float]
=== Response as text, json, smile, yaml or cbor
=== text json smile yaml 或者 cbor 响应

[source,sh]
--------------------------------------------------
Expand All @@ -150,16 +140,16 @@ If you want to change the <<byte-units,byte units>>, use `bytes` parameter.
--------------------------------------------------
// NOTCONSOLE

Currently supported formats (for the `?format=` parameter):
目前支持的格式 (for the `?format=` parameter):
- text (default)
- json
- smile
- yaml
- cbor

Alternatively you can set the "Accept" HTTP header to the appropriate media format.
All formats above are supported, the GET parameter takes precedence over the header.
For example:
或者,你可以设置 "Accept" HTTP 头为适当的媒体格式。
以上所有格式均受支持,GET 参数优先于头部。
例如:

[source,sh]
--------------------------------------------------
Expand All @@ -182,25 +172,24 @@ For example:

[float]
[[sort]]
=== Sort
=== 排序

Each of the commands accepts a query string parameter `s` which sorts the table by
the columns specified as the parameter value. Columns are specified either by name or by
alias, and are provided as a comma separated string. By default, sorting is done in
ascending fashion. Appending `:desc` to a column will invert the ordering for
that column. `:asc` is also accepted but exhibits the same behavior as the default sort order.
每个命令都接受一个字符串参数 `s` ,它可以指定为参数值的列对表格进行排序。
列由名称或别名指定,并以逗号分隔的字符串形式提供。
默认情况下,排序按照升序方式完成。
追加 `:desc` 到一列会将该列以降序排序。
`:asc` 也被接受,但表现出与默认排序顺序相同的行为。

For example, with a sort string `s=column1,column2:desc,column3`, the table will be
sorted in ascending order by column1, in descending order by column2, and in ascending
order by column3.
例如,对于一个排序字符串 `s=column1,column2:desc,column3` ,
该表格将按 column1 升序, column2 降序, column3 升序排序。

[source,sh]
--------------------------------------------------
GET _cat/templates?v&s=order:desc,index_patterns
--------------------------------------------------
//CONSOLE

returns:
返回:

[source,txt]
--------------------------------------------------
Expand Down
12 changes: 4 additions & 8 deletions docs/reference/cat/alias.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[[cat-alias]]
== cat aliases

`aliases` shows information about currently configured aliases to indices
including filter and routing infos.
`aliases` 显示当前相关配置到索引的别名信息,包括过滤器和路由信息。

////
Hidden setup for example:
Expand Down Expand Up @@ -39,7 +38,7 @@ GET /_cat/aliases?v
// CONSOLE
// TEST[continued]

Might respond with:
可能响应:

[source,txt]
--------------------------------------------------
Expand All @@ -51,9 +50,6 @@ alias4 test1 - 2 1,2
--------------------------------------------------
// TESTRESPONSE[s/[*]/[*]/ _cat]

The output shows that `alias2` has configured a filter, and specific routing
configurations in `alias3` and `alias4`.
输出显示 `alias2` 已经配置了一个过滤器,和 `alias3` 和 `alias4` 中的特定路由配置。

If you only want to get information about specific aliases, you can specify
the aliases in comma-delimited format as a URL parameter, e.g.,
/_cat/aliases/aliases/alias1,alias2.
如果你只想获取有关特定别名的信息,你可以以逗号分隔格式指定别名作为 URL 参数,例如,/_cat/aliases/aliases/alias1,alias2 。
8 changes: 3 additions & 5 deletions docs/reference/cat/allocation.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[[cat-allocation]]
== cat allocation

`allocation` provides a snapshot of how many shards are allocated to each data node
and how much disk space they are using.
`allocation` 提供了分配给每个数据节点的分片数量以及它们正在使用磁盘空间大小的快照。

[source,js]
--------------------------------------------------
Expand All @@ -11,7 +10,7 @@ GET /_cat/allocation?v
// CONSOLE
// TEST[s/^/PUT test\n{"settings": {"number_of_replicas": 0}}\n/]

Might respond with:
可能响应:

[source,txt]
--------------------------------------------------
Expand All @@ -21,5 +20,4 @@ shards disk.indices disk.used disk.avail disk.total disk.percent host ip
// TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/ s/46/\\d+/]
// TESTRESPONSE[s/CSUXak2/.+/ _cat]

Here we can see that each node has been allocated a single shard and
that they're all using about the same amount of space.
在这里我们可以看到每个节点都被分配了一个分片和他们都使用了大约相同数量的空间。
9 changes: 4 additions & 5 deletions docs/reference/cat/count.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[[cat-count]]
== cat count

`count` provides quick access to the document count of the entire
cluster, or individual indices.
`count` 可以快速访问整个集群或单个索引的文档数量。

[source,js]
--------------------------------------------------
Expand All @@ -12,7 +11,7 @@ GET /_cat/count?v
// TEST[setup:big_twitter]
// TEST[s/^/POST test\/test\?refresh\n{"test": "test"}\n/]

Looks like:
结果如下:

[source,txt]
--------------------------------------------------
Expand All @@ -21,7 +20,7 @@ epoch timestamp count
--------------------------------------------------
// TESTRESPONSE[s/1475868259 15:24:19/\\d+ \\d+:\\d+:\\d+/ _cat]

Or for a single index:
或者对于单个索引:

[source,js]
--------------------------------------------------
Expand All @@ -38,4 +37,4 @@ epoch timestamp count
// TESTRESPONSE[s/1475868259 15:24:20/\\d+ \\d+:\\d+:\\d+/ _cat]


NOTE: The document count indicates the number of live documents and does not include deleted documents which have not yet been cleaned up by the merge process.
NOTE: 文档计数表示活动文档的数量,不包括合并过程尚未清除的已删除文档。
15 changes: 7 additions & 8 deletions docs/reference/cat/fielddata.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[[cat-fielddata]]
== cat fielddata

`fielddata` shows how much heap memory is currently being used by fielddata
on every data node in the cluster.
`fielddata` 显示了集群中每个数据节点上被 fielddata 正在使用的堆内存大小。


////
Expand Down Expand Up @@ -45,7 +44,7 @@ GET /_cat/fielddata?v
// CONSOLE
// TEST[continued]

Looks like:
结果如下:

[source,txt]
--------------------------------------------------
Expand All @@ -56,7 +55,7 @@ Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
// TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
// TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body/\\w+/ _cat]

Fields can be specified either as a query parameter, or in the URL path:
可以将字段指定为查询参数,也可以在 URL 路径中指定:

[source,js]
--------------------------------------------------
Expand All @@ -65,7 +64,7 @@ GET /_cat/fielddata?v&fields=body
// CONSOLE
// TEST[continued]

Which looks like:
结果如下:

[source,txt]
--------------------------------------------------
Expand All @@ -75,7 +74,7 @@ Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in body 544b
// TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
// TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ _cat]

And it accepts a comma delimited list:
它接受逗号分隔的字段列表:

[source,js]
--------------------------------------------------
Expand All @@ -84,7 +83,7 @@ GET /_cat/fielddata/body,soul?v
// CONSOLE
// TEST[continued]

Which produces the same output as the first snippet:
它产生与第一个片段相同的输出:

[source,txt]
--------------------------------------------------
Expand All @@ -95,4 +94,4 @@ Nqk-6inXQq-OxUfOUI8jNQ 127.0.0.1 127.0.0.1 Nqk-6in soul 480b
// TESTRESPONSE[s/544b|480b/\\d+(\\.\\d+)?[tgmk]?b/]
// TESTRESPONSE[s/Nqk-6in[^ ]*/.+/ s/soul|body/\\w+/ _cat]

The output shows the individual fielddata for the `body` and `soul` fields, one row per field per node.
输出显示 `body` `soul` 字段各自的 fielddata ,每个节点每个字段一行。
Loading

0 comments on commit dcd4667

Please sign in to comment.