# Kibana index pattern creation through UI and REST leading to duplicates

**URL:** https://discuss.elastic.co/t/kibana-index-pattern-creation-through-ui-and-rest-leading-to-duplicates/291553
**Category:** Kibana
**Created:** [December 12, 2021, 5:09pm UTC](https://discuss.elastic.co/t/kibana-index-pattern-creation-through-ui-and-rest-leading-to-duplicates/291553 "2021-12-12T17:09:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shivani\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@shivani\_aggarwal](https://discuss.elastic.co/u/shivani_aggarwal)
#### Post date: [December 12, 2021, 5:09pm UTC](https://discuss.elastic.co/t/kibana-index-pattern-creation-through-ui-and-rest-leading-to-duplicates/291553/1 "2021-12-12T17:09:17Z")

</div>

Found similar issue reported in [Same index-pattern created with kibana UI and REST command](https://discuss.elastic.co/t/same-index-pattern-created-with-kibana-ui-and-rest-command/280079) which got auto-closed due to lack of response.

Version: Kibana-oss 7.10.2  
Issue: Say an index pattern say journal-2021.07.27 is created through Stack management page of Kibana UI.  
Next, if using the kibana saved objects REST API, an index pattern with same name is created:

> curl -XPOST [http://localhost:5601/api/saved\_objects/index-pattern/journal-2021.07.27](http://localhost:5601/api/saved_objects/index-pattern/journal-2021.07.27) -H 'kbn-xsrf: true' -H 'Content-type: application/json' -d'{"attributes": {"title" : "journal-2021.07.27"}}'  
> **Response -\>** {"type":"index-pattern","id":"journal-2021.07.27","attributes":{"title":"journal-2021.07.27"},"references":,"migrationVersion":{"index-pattern":"7.6.0"},"updated\_at":"2021-07-29T05:19:30.633Z","version":"WzQsMV0="}

This creates two index patterns in kibana with exact same name, which is not expected and seems like a bug.

Any suggestions if its already fixed in recent versions of kibana?

---

<div class="post-metadata">

### Author: ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)
#### Post date: [December 14, 2021, 10:00am UTC](https://discuss.elastic.co/t/kibana-index-pattern-creation-through-ui-and-rest-leading-to-duplicates/291553/2 "2021-12-14T10:00:27Z")

</div>

Saved objects API bypasses any application level logic, so there is no way for index pattern code to check if there is no existing index pattern with the same pattern when using this API.

We recommend using higher level API for this: [Index patterns APIs | Kibana Guide [7.16] | Elastic](https://www.elastic.co/guide/en/kibana/7.16/index-patterns-api.html)

---

<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: [January 11, 2022, 10:01am UTC](https://discuss.elastic.co/t/kibana-index-pattern-creation-through-ui-and-rest-leading-to-duplicates/291553/3 "2022-01-11T10:01:01Z")

</div>

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