简体   繁体   English

ElasticSearch-Kibana-无法使用Python获取索引模式

[英]ElasticSearch - Kibana - Not able to get Index Pattern with Python

I'm creating a python script in order to get access to my Index Patterns that I create on Kibana. 我正在创建一个python脚本,以访问在Kibana上创建的索引模式。 First, I am trying to list that indexes using: 首先,我尝试使用以下方式列出该索引:

for index in es.indices.get('*'):
  print index

And if I go to Kibana on Management -> Kibana -> Index Patterns I am seeing the following indexes: 如果我在管理上转到Kibana-> Kibana->索引模式,则会看到以下索引:

  • kibana_sample_data_flights kibana_sample_data_flights
  • kibana_sample_data_logs kibana_sample_data_logs

However when I run my previous script I am only able to see the index that I create using this script: 但是,当我运行上一个脚本时,我只能看到使用此脚本创建的索引:

from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()

doc = {
    'author': 'John',
    'text': 'Elasticsearch: good tool',
    'timestamp': datetime.now(),
}
res = es.index(index="test-index", doc_type='tweet', id=1, body=doc)
print(res['result'])

My question is: When I call "es.indices" I am not accessing to the Indexes from Kibana? 我的问题是:当我调用“ es.indices”时,我是否无法从Kibana访问索引? Why I cannot see my indexes patterns using elasticsearch library in Python? 为什么我无法在Python中使用Elasticsearch库看到索引模式?

Thanks! 谢谢!

You could try - doc here : 您可以尝试-doc在这里

resultL = []         
res = es.cat.indices(format="json")         
for line in res:
             resultL.extend([line[key] for key in line if key==u"index"])         
return resultL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python,ElasticSearch / Kibana'kibanaSavedObjectMeta'可视化元数据索引替换 - Python, ElasticSearch/Kibana 'kibanaSavedObjectMeta' Visualization Metadata Index replace 从 Python 查询 Elasticsearch 索引从 Kibana 返回 0 次命中但数千次 - Querying Elasticsearch Index from Python returns 0 hits but thousands from Kibana 将 Kibana 查询(创建索引模式)转换为 Python 请求 - Convert Kibana query (create index pattern) to Python request 获取索引elasticsearch python中的所有字段名称 - Get all field names in an index elasticsearch python Elasticsearch Python API GET索引统计信息 - Elasticsearch python api GET index stats 在python上运行elasticsearch和kibana时出现回溯错误 - Traceback error when running elasticsearch and kibana on python Python,无法使索引在我的列表中工作 - Python, not able to get the index working in my list elasticsearch / Kibana列表字段为“?”,尽管索引中为“文本”,为什么? - elasticsearch/Kibana list field as “?”, although it is “text” in index, why? 如何在Elasticsearch中保存坐标以建立索引并在Kibana中使用它们 - How to save coordinates to index in Elasticsearch and use them in Kibana 在 Python 中将 CSV 索引到 ElasticSearch - Index CSV to ElasticSearch in Python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM