[ElasticSearch] _cat 接口名字的由来猜测

陪她去流浪 桃子 2019年09月23日 阅读次数:1792

**注:**这是我写的第一篇关于ElasticSearch 搜索引擎的文章。现在在公司管理有数百个节点的集群,以后会写一些相关的文章。

ElasticSearch 中有一个获取常用信息的接口地址_cat,比如:

  • _cat/alias 获取索引别名信息
  • _cat/allocation 获取数据节点的分片数量快照和磁盘空间信息
  • _cat/health 获取集群健康状态信息
  • ...

为什么叫_cat呢?很多人不知道,很多人也不确定。官方文档也没有找到明确的定义,关键网上也没找看到人讨论,同事问了我几次。。。

所以我收集了几种常见的解释,仅供参考?

一、乃 category(分类)的缩写

这个是比较常见且容易想到的。

二、其实它就是 cat 的本意:猫

毕竟,你可以通过下面输出内容的第一行可以看出:

GET _cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
...

看到胡须了没??

三、紧凑且对齐的文本

它是compact and aligned text的缩写,我且把它翻译成“紧凑且对齐的文本”。因为这个API的输出全部是以表格的形式展示结果,紧凑又对齐!

这个说明来自官方的文档,但是不能确定这就是对cat的定义:

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 a terminal, need compact and aligned text
The cat API aims to meet this need.

标签:ElasticSearch