等同于 Python 中的“GET _mapping”marvel/sense?

Equivalent of `GET _mapping` marvel/sense in Python?

我正在尝试使用 python 探索 elasticsearch 集群,我是 elasticsearch 的新手。如果我使用 Marvel/Sense,我可以使用 GET _mapping 查看集群的模式。在 Python 中是否有等效的方法来执行此操作?如果是这样我可以看到集群的"schema"!

更一般地说,我想以编程方式发现所有索引,每个索引'doc_types,对doc_types'字段进行分类(它们是文本字符串,整数,浮点数,什么范围数字的需要,..)基本上了解每个领域的模式和基本统计​​数据。如果有比 GET _mapping 更好的方法来开始这个项目,我会洗耳恭听。

这与 有关,他们正在使用 Python 查找索引列表,但更通用。

您可以使用 pyelasticsearch 来做到这一点。 This 是你可以做到的 GET _mapping 在 python。

来自文档

get_mapping(index=None, doc_type=None) [source]

Fetch the mapping definition for a specific index and type.

Parameters:

  • index – An index or iterable thereof

  • doc_type – A document type or iterable thereof

Omit both arguments to get mappings for all types and indexes.

探索 API 以了解更多信息