Skip to content Skip to sidebar Skip to footer

Convert Kibana Query (create Index Pattern) To Python Request

I'm trying to convert this Kibana query to Python: PUT /.kibana/_doc/index-pattern:tempindex { 'type': 'index-pattern', 'index-pattern': { 'title': 'tempindex', 'timeFi

Solution 1:

Seems that just changing the uri does the trick:

uri = "http://localhost:9200/.kibana/_doc/index-pattern:tempindex"

But I'm not sure about the HEADERS, cuz as lupanoide pointed out, kbn-xsrf: true should be present, but either way it seems to be working and apparently the results are the same (I haven't spotted a difference yet).

Edit: As the doc says:

kbn-xsrf: true

By default, you must use kbn-xsrf for all API calls, except in the following scenarios:

The API endpoint uses the GET or HEAD operations The path is whitelisted using the server.xsrf.whitelist setting XSRF protections are disabled using the server.xsrf.disableProtection setting

So I think it should be present.

Post a Comment for "Convert Kibana Query (create Index Pattern) To Python Request"