1

I am trying use embedding models in elastic search following this tutorial

When I run this command

docker run -it --rm elastic/eland \
eland_import_hub_model \
--url https://username:password@localhost:9200/ \
--hub-model-id sentence-transformers/msmarco-MiniLM-L-12-v3 \
--task-type text_embedding \
--start

I get the below error.

Traceback (most recent call last):
  File "/usr/local/bin/eland_import_hub_model", line 190, in <module>
    es = get_es_client(args)
  File "/usr/local/bin/eland_import_hub_model", line 153, in get_es_client
    es_info = es_client.info()
  File "/usr/local/lib/python3.9/dist-packages/elasticsearch/_sync/client/utils.py", line 414, in wrapped
    return api(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/elasticsearch/_sync/client/__init__.py", line 2295, in info
    return self.perform_request(  # type: ignore[return-value]
  File "/usr/local/lib/python3.9/dist-packages/elasticsearch/_sync/client/_base.py", line 285, in perform_request
    meta, resp_body = self.transport.perform_request(
  File "/usr/local/lib/python3.9/dist-packages/elastic_transport/_transport.py", line 329, in perform_request
    meta, raw_data = node.perform_request(
  File "/usr/local/lib/python3.9/dist-packages/elastic_transport/_node/_http_urllib3.py", line 199, in perform_request
    raise err from None
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPSConnection object at 0xffff6c8e9fd0>: Failed to establish a new connection: [Errno 111] Connection refused))

I could connect to ES from kibana and postman and do the API requests. But I could not run the above command. Any ideas?

Sazzad
  • 773
  • 11
  • 22
  • can you please provide which URL you are using for accessing from potsman ? is it wirh https or http? also, are you running this script on the same server where elasticsearch is running or it is diffrent server? – Sagar Patel Mar 27 '23 at 13:03
  • Yes, Postman is using also [https](https://localhost:9200/_cat/indices?v) Both are on the same server (which is my localhost) – Sazzad Mar 27 '23 at 13:19
  • But post man using the `Authorization` header with base64 encoding of user name and password. – Sazzad Mar 27 '23 at 13:21
  • I am not sure baout docker but when command is run using python it is working fine. Can you please check my [blog](https://medium.com/@psajan106/elasticsearch-8-named-entity-recognition-ner-using-inference-ingest-pipeline-8e7bd566c5e8) where i have updated model for NER. – Sagar Patel Mar 27 '23 at 13:21
  • I could successfully hit from curl using plain username and password with this command curl -H "Content-Type: application/x-ndjson" -XPOST https://localhost:9200/a_index/bulkdata --data-binary "@bulk-data.json" -k -u username – Sazzad Mar 27 '23 at 13:21
  • then might be its docker issue. Can you please run command using as i mentioned in above blog. – Sagar Patel Mar 27 '23 at 13:22
  • thanks, @SagarPatel, I will try and let you know soon/ – Sazzad Mar 27 '23 at 13:25
  • It looks for the eland_import_hub_model file in the current directory. But this file was not generated after I run docker build -t elastic/eland . Am I missing something? – Sazzad Mar 27 '23 at 13:40
  • I am not sure about Docker. Can you try to execute again and see if there is any error it show after executing command. – Sagar Patel Mar 27 '23 at 14:25
  • I could run with your suggested command. But now it fails on `elasticsearch.AuthorizationException: AuthorizationException(403, 'security_exception', 'current license is non-compliant for [ml]')` I am running on localhost. Still licensing required! – Sazzad Mar 27 '23 at 14:30
  • It was a licnese problem. I could revolve the above one. But Now I am getting error when In run `POST /_ml/trained_models/sentence-transformers__msmarco-minilm-l-12-v3/deployment/_infer { "docs": { "text_field": "how is the weather in jamaica" } }` – Sazzad Mar 27 '23 at 14:57
  • It returns `{ "error": { "root_cause": [ { "type": "status_exception", "reason": "Trained model [sentence-transformers__msmarco-minilm-l-12-v3] is not allocated to any nodes" } ], "type": "status_exception", "reason": "Trained model [sentence-transformers__msmarco-minilm-l-12-v3] is not allocated to any nodes" }, "status": 409 }` – Sazzad Mar 27 '23 at 14:58
  • Go to the Kibana ML Model Section and from there stop model and start again. it will resolved your issue. – Sagar Patel Mar 27 '23 at 15:32
  • Thanks @ Sagar, I took a free license and it worked after some more issues. For example Pytorch version. Surprisingly, It reads pytorch version virtual env rather than the docker image. But now model is at least uploaded successfully – Sazzad Mar 28 '23 at 08:21

0 Answers0