# How to create a data view and an index aat the same time in elastic search using python

**URL:** https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620
**Category:** Elasticsearch
**Created:** [December 6, 2022, 7:25pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620 "2022-12-06T19:25:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Shashank02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shashank02/32/99866_2.png) [@Shashank02](https://discuss.elastic.co/u/Shashank02)
#### Post date: [December 6, 2022, 7:25pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620/1 "2022-12-06T19:25:42Z")

</div>

I am trying to push a CSV file directly into Elasticsearch using python and it's working. But, it is only creating an index. I want to create a data view along with it so that I can create a dashboard in Kibana but I'm getting a few errors mainly Deprecation Warnings. So, can anyone please help me in this matter?

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [December 6, 2022, 7:33pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620/2 "2022-12-06T19:33:52Z")

</div>

I have never done it but seems like you have to use kibana api for it

> **[Create data view API | Kibana Guide \[master\] | Elastic](https://www.elastic.co/guide/en/kibana/master/data-views-api-create.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [December 6, 2022, 7:37pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620/3 "2022-12-06T19:37:06Z")

</div>

this is how I have use kibana api in past. for example to retrieve all the space in kibana

```auto
url_space=f'http://{master}:5601/api/spaces/space'
space_names = requests.get(url_space, auth=(elk_admin_user,elk_admin_password))

```

---

<div class="post-metadata">

### Author: ![Shashank02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shashank02/32/99866_2.png) [@Shashank02](https://discuss.elastic.co/u/Shashank02)
#### Post date: [December 6, 2022, 7:39pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620/4 "2022-12-06T19:39:46Z")

</div>

Okay, thanks!

---

<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 3, 2023, 7:40pm UTC](https://discuss.elastic.co/t/how-to-create-a-data-view-and-an-index-aat-the-same-time-in-elastic-search-using-python/320620/5 "2023-01-03T19:40:06Z")

</div>

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