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


#1

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 :

You can find the data I try to add here

Annex :


(system) #2

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