# Not able to instantiate ES object orientedly, the mapping types being removed are guilty

**URL:** <https://discuss.elastic.co/t/not-able-to-instantiate-es-object-orientedly-the-mapping-types-being-removed-are-guilty/132341>\
**Category:** Elasticsearch\
**Created:** [May 17, 2018, 1:27pm UTC](https://discuss.elastic.co/t/not-able-to-instantiate-es-object-orientedly-the-mapping-types-being-removed-are-guilty/132341 "2018-05-17T13:27:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeE](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@MikeE](https://discuss.elastic.co/u/MikeE)\
**Post date:** [May 17, 2018, 1:27pm UTC](https://discuss.elastic.co/t/not-able-to-instantiate-es-object-orientedly-the-mapping-types-being-removed-are-guilty/132341/1 "2018-05-17T13:27:51Z")

</div>

I tried to transform the creation of my database Elasticsearch, a script, in an object-oriented format but then create the database by instantiating it in the `Main.py`, and nothing else is passed:

**Main.py :**

```
from Elastic import Elastic

el = Elastic()

print("server is ready")

```

**Elastic.py :**

```
import csv
import glob
import os
from elasticsearch import helpers, Elasticsearch

class Elastic:
    def __init__ (self):
        es = Elasticsearch()

        for path in glob.glob("*.csv"):
            with open(path, newline='') as csvfile:
                reader = csv.DictReader(csvfile, delimiter=';', quotechar='|')
                csv_name = os.path.splitext(path)[0]
                helpers.bulk(es, reader, index="index1", doc_type=csv_name)

```

But I get teh following message which don't seem to instantiate teh last object I tried to add :

[![](https://i.stack.imgur.com/3Au1t.png) ](https://i.stack.imgur.com/3Au1t.png)

You can find the data I try to add [here](https://hesa.azureedge.net/unistats/unistats_latest.zip)

Annex :

- the whole git repository is here
- the [./elasticsearch terminal message](https://textsaver.flap.tv/lists/1yvp) after I tried to instantiate elasticsearch
- the [python3 Main.py](https://textsaver.flap.tv/lists/1yvo) terminal message

---

<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:** [June 14, 2018, 1:28pm UTC](https://discuss.elastic.co/t/not-able-to-instantiate-es-object-orientedly-the-mapping-types-being-removed-are-guilty/132341/2 "2018-06-14T13:28:01Z")

</div>

Closed on June 14, 2018, 1:28pm UTC

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