(conf: DatasourceConf)
| 37 | |
| 38 | # get tables |
| 39 | def 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 |
no test coverage detected