It didn't.
(Just to clarify: I know how to create an index pattern; I want to set an index pattern as the default).
The header and query stayed same, just changing the uri:
HEADERS = {
"kbn-xsrf": "true",
'Content-Type': 'application/json'
}
query = json.dumps({'attributes':{'defaultIndex': 'my_index_pattern'}})
r = requests.post(uri, headers=HEADERS, data=query).json()
uri = "http://localhost:5601/s/api/saved_objects/index-pattern/my_index_pattern"
Error: {'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}
uri = "http://localhost:9200/s/api/saved_objects/index-pattern/my_index_pattern"
Error: {'error': 'no handler found for uri [/s/api/saved_objects/index-pattern/stock_tweets] and method [POST]'}
uri = "http://localhost:5601/s/api/saved_objects/config/7.8.0"
Error: {'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}
uri = "http://localhost:9200/s/api/saved_objects/config/7.8.0"
Error: {'error': 'no handler found for uri [/s/api/saved_objects/config/7.8.0] and method [POST]'}
uri = "http://localhost:5601/api/saved_objects/config/7.8.0"
Error: {'statusCode': 409, 'error': 'Conflict', 'message': '[config:7.8.0]: version conflict, document already exists (current version [2]): [version_conflict_engine_exception] [config:7.8.0]: version conflict, document already exists (current version [2]), with { index_uuid="O0QpGH7BSIqBdpyq9r3vCA" & shard="0" & index=".kibana_2" }'}
uri = "http://localhost:9200/api/saved_objects/config/7.8.0"
Error: {'error': 'no handler found for uri [/api/saved_objects/config/7.8.0] and method [POST]'}
uri = "http://localhost:5601/.kibana/api/saved_objects/config/7.8.0"
Error: {'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}
uri = "http://localhost:9200/.kibana/saved_objects/config/7.8.0"
Error: {'error': 'no handler found for uri [/.kibana/saved_objects/config/7.8.0] and method [POST]'}
uri = "http://localhost:5601/.kibana/saved_objects/config/7.8.0"
Error: {'statusCode': 404, 'error': 'Not Found', 'message': 'Not Found'}
uri = "http://localhost:9200/.kibana/saved_objects/config/7.8.0"
Error: {'error': 'no handler found for uri [/.kibana/saved_objects/config/7.8.0] and method [POST]'}
uri = "http://localhost:9200/.kibana/config/7.8.0"
Error: {'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'Rejecting mapping update to [.kibana_2] as the final mapping would have more than 1 type: [_doc, config]'}], 'type': 'illegal_argument_exception', 'reason': 'Rejecting mapping update to [.kibana_2] as the final mapping would have more than 1 type: [_doc, config]'}, 'status': 400}
uri = "http://localhost:9200/.kibana/api/saved_objects/config/7.8.0"
Error: {'error': 'no handler found for uri [/.kibana/api/saved_objects/config/7.8.0] and method [POST]'}