'AttributeError: 'Elasticsearch' object has no attribute 'options'
I am trying to build a model using elasticsearch in python but I am getting this error, I was able to execute it once but now I cannot run it again due to this error
import pandas as pd
df = pd.read_csv("salaries.csv")
df.head()
inputs = df.drop('salary_more_then_100k',axis='columns')
target = df['salary_more_then_100k']
from sklearn.preprocessing import LabelEncoder
le_company = LabelEncoder()
le_job = LabelEncoder()
le_degree = LabelEncoder()
inputs['company_n'] = le_company.fit_transform(inputs['company'])
inputs['job_n'] = le_job.fit_transform(inputs['job'])
inputs['degree_n'] = le_degree.fit_transform(inputs['degree'])
inputs
inputs_n = inputs.drop(['company','job','degree'],axis='columns')
inputs_n
target
from sklearn import tree
model = tree.DecisionTreeClassifier()
model.fit(inputs_n, target)
from eland.ml import MLModel
from elasticsearch import Elasticsearch
es = Elasticsearch(hosts='http://localhost:9200')
es_model = MLModel.import_model(es_client=es,
model=model,
model_id='salaries-model',
feature_names=list(df.columns),
es_if_exists='replace'
)
When I run the es_model line, I get this error -> AttributeError: 'Elasticsearch' object has no attribute 'options'
What am I doing wrong, Can anyone please tell me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
