You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from elasticsearch import Elasticsearch
from elasticsearch.client.xpack import MlClient
es = elastic_connection()
es_ml = MlClient(es)
def post_training_data(directory='Training Data', file_name='file_name.json'):
with open(os.path.join(directory, file_name), mode='r') as train_file:
train_data = json.load(train_file)
es_ml.post_data(job_id=job_id, body=train_data)
post_training_data()
Here is the error I am getting when sending json docs:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "..\train_model.py", line 218, in post_training_data
self.es_ml.post_data(job_id=self.job_id, body=train_data)
File "..\inc_anamoly\lib\site-packages\elasticsearch\client\utils.py", line 76, in _wrapped
return func(*args, params=params, **kwargs)
File "..\inc_anamoly\lib\site-packages\elasticsearch\client\xpack\ml.py", line 81, in post_data
body=self._bulk_body(body))
AttributeError: 'MlClient' object has no attribute '_bulk_body'
The text was updated successfully, but these errors were encountered:
If I remove body=self._bulk_body(body) from the post_data method in ml.py and replace with body=body I was able to send json docs in the above format. Should the _bulk_body be called in the post_data method in the MlClient?
I am unable to post data to machine learning jobs via the MlClient post_data method. There seems to be a problem with getting the data:
Here is a json doc example named file_name.json:
Here is some example code used to post the data:
Here is the error I am getting when sending json docs:
The text was updated successfully, but these errors were encountered: