MCPcopy Index your code
hub / github.com/dataease/SQLBot / get_es_index

Function get_es_index

backend/apps/db/es_engine.py:39–53  ·  view source on GitHub ↗
(conf: DatasourceConf)

Source from the content-addressed store, hash-verified

37
38# get tables
39def get_es_index(conf: DatasourceConf):
40 es_client = get_es_connect(conf)
41 indices = es_client.cat.indices(format="json")
42 res = []
43 if indices is not None:
44 for idx in indices:
45 index_name = idx.get('index')
46 desc = ''
47 # get mapping
48 mapping = es_client.indices.get_mapping(index=index_name)
49 mappings = mapping.get(index_name).get("mappings")
50 if mappings.get('_meta'):
51 desc = mappings.get('_meta').get('description')
52 res.append((index_name, desc))
53 return res
54
55
56# get fields

Callers 1

get_tablesFunction · 0.90

Calls 3

get_es_connectFunction · 0.85
getMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected