# Snapshot with index pattern

**URL:** <https://discuss.elastic.co/t/snapshot-with-index-pattern/145196>\
**Category:** Elasticsearch\
**Created:** [August 20, 2018, 3:02pm UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196 "2018-08-20T15:02:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rog\_NB](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rog\_NB](https://discuss.elastic.co/u/rog_NB)\
**Post date:** [August 20, 2018, 3:02pm UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196/1 "2018-08-20T15:02:46Z")

</div>

Hello

I'm trying to create a python script to automaticly create snapshots. This is not a big deal.  
But will use kibanas "Index Pattern".  
You find that under kibana - Management /Kibana. there you may create a new Index Pattern. Is there any way to read out those Index Patterns? Hopefully somehow with any API/Python.  
i.e. I have some Patterns: "auditbeat-_", metricbeat-_"  
Those Index Pattern gat at the end a date.  
I know how to do a snapshot of "auditbeats" but as I would like to automate as much as possible, I would like to read out the Patterns. But I have to know first, that there is a "autidbeats"...  
Of course I may list all Indices, sort it, cut it, parse it... I'm happy, if there is an easier way...

thanks  
rog

---

<div class="post-metadata">

**Author:** ![\_Alex](https://avatars.discourse-cdn.com/v4/letter/_/54ee81/32.png) [@\_Alex](https://discuss.elastic.co/u/_Alex)\
**Post date:** [August 20, 2018, 3:15pm UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196/2 "2018-08-20T15:15:36Z")

</div>

You can use the [Saved Objects API](https://github.com/elastic/kibana/pull/11632). For example:

```
https://your-kibana-instance.com/api/saved_objects?fields=title

```

Will give you all your index patterns.

---

<div class="post-metadata">

**Author:** ![rog\_NB](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rog\_NB](https://discuss.elastic.co/u/rog_NB)\
**Post date:** [August 21, 2018, 5:47am UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196/3 "2018-08-21T05:47:40Z")

</div>

Thank you  
Pretty nice idea. But how do I call/see the Index Patterns?  
As I said, I'm able to call functions/requests and so on via Python. What I need to know is the command to see the "Index Patterns"-List.

thanks  
rog

---

<div class="post-metadata">

**Author:** ![\_Alex](https://avatars.discourse-cdn.com/v4/letter/_/54ee81/32.png) [@\_Alex](https://discuss.elastic.co/u/_Alex)\
**Post date:** [August 21, 2018, 9:10am UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196/4 "2018-08-21T09:10:04Z")

</div>

You should use your favourite Python HTTP library - here is a version in python 2.7 using `requests`:

```
import json
import requests

response = requests.get("https://your-kibana-instance.com/api/saved_objects?fields=title&per_page=500")
json_data = json.loads(response.text)
print [pattern.get('attributes').get('title') for pattern in json_data.get('saved_objects') if pattern.get('type') == 'index-pattern']
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 18, 2018, 9:10am UTC](https://discuss.elastic.co/t/snapshot-with-index-pattern/145196/5 "2018-09-18T09:10:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
