相当于“GET _mapping”的奇迹/感觉在Python中? [英] Equivalent of `GET _mapping` marvel/sense in Python?

查看:175
本文介绍了相当于“GET _mapping”的奇迹/感觉在Python中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python来探索一个弹性搜索集群,而我是弹性搜索的新手。如果我使用Marvel / Sense,我可以使用 GET _mapping 查看集群的模式。在Python中有相当的方法吗?如果是这样,我可以看到集群的架构!



更一般来说,我想以编程方式发现所有的指标,每个索引的doc_types都将doc_types分类'字段(它们是文本字符串,int,float,数字的范围,...)基本上学习每个字段的模式和基本统计​​信息。如果有一个比 GET _mapping 更好的方式来启动这个项目,我就是耳朵。



这与这个问题,他们正在使用Python寻找索引列表,但更为通用。

解决方案

你可以用pyelasticsearch做到这一点。 这个是如何做的code> GET _mapping
在python中。



从文档


get_mapping(index = None,doc_type = None) [来源]



获取特定索引的映射定义并键入。



参数:




  • index - 索引或可迭代


  • doc_type - 文档类型或可迭代的




省略两个参数以获取所有类型和索引的映射。


浏览 API 了解详情


I'm trying to explore an elasticsearch cluster using python, and I'm new to elasticsearch. If I use Marvel/Sense, I can see the cluster's schema using GET _mapping. Is there an equivalent way to do this in Python? If so I can see the "schema" of the cluster!

More generally, I'd like to discover programmatically all the indicies, each indices' doc_types, classify the doc_types' fields (are they text strings, ints, floats, what range to the numeric ones take, ..) basically learn the schema and basic statistics of each field. If there is a better way than GET _mapping to start this project, I'm all ears.

This is related to this question, where they are looking for a list of indices using Python, but is more general.

解决方案

You can do that with pyelasticsearch. This is how you can do GET _mapping in python.

From the Docs

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.

Explore API to learn more

这篇关于相当于“GET _mapping”的奇迹/感觉在Python中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆