Hi Experts ,
I am new to python , I want to create an index in ES on cluster health API . I got the following code but it's not providing me output the way I want .
import json
import requests
stats = requests.get('http://localhost:9200/_cluster/health').json()
abc=stats['cluster_name']
bulk_data = ''
bulk_data += '{"index": {"_index": "cluster", "_type": "clust"}}\n'
bulk_data += json.dumps(abc) + '\n'
response = requests.post('http://localhost:9200/_bulk', data=bulk_data)
Above script is able to create an index but when I am checking the data I got nothing , even in kibana when I select _timestamp filed I got nothing . Not sure what I am doing wrong . In kibana I want to see all the fields like .
"cluster_name": "elasticsearch",
"status": "yellow",
"timed_out": false,
"number_of_nodes": 1,
"number_of_data_nodes": 1,
"active_primary_shards": 92,
"active_shards": 92,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 92,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0
Please help