# Authorization exception when trying to import model to Elasticsearch cluster

**URL:** <https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security, elastic-stack-machine-learning\
**Created:** [July 18, 2022, 4:09am UTC](https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840 "2022-07-18T04:09:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![green12](https://avatars.discourse-cdn.com/v4/letter/g/58956e/32.png) [@green12](https://discuss.elastic.co/u/green12)\
**Post date:** [July 18, 2022, 4:09am UTC](https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840/1 "2022-07-18T04:09:57Z")

</div>

Hi all. This is my first time using Elasticsearch. Currently I've just deployed a cluster consisted of 3 nodes in my localhost.

I'm trying to import a NER NLP model using eland based on [https://www.elastic.co/guide/en/elasticsearch/client/eland/current/machine-learning.html:](https://www.elastic.co/guide/en/elasticsearch/client/eland/current/machine-learning.html:)

```
import elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel

tmp_path = 'models'
Path(tmp_path).mkdir(parents=True, exist_ok=True)
model_path, config, vocab_path = tm.save(tmp_path)

es_url = 'http://localhost:9201'
es = elasticsearch.Elasticsearch(es_url, request_timeout=300)

ptm = PyTorchModel(es, tm.elasticsearch_model_id())

ptm.import_model(
    model_path=model_path, 
    config_path=None, 
    vocab_path=vocab_path, 
    config=config)

```

The problem is, when I tried to run the last command (import\_model), it produced the following exception:

```
AuthorizationException: AuthorizationException(403, 'security_exception', 'current license is non-compliant for [ml]')

```

I tried to do some searching and I'm guessing it's a problem with xpack.ml.enabled (?) The only xpack configuration I provided in my nodes yml file is `xpack.security.enabled = false`. In that case, shouldn't `xpack.ml.enabled` be `true` since its the default value?

Or is this caused by a completely different problem?

Any help would be appreciated, thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![BenTrent](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentrent/32/33915_2.png) [@BenTrent](https://discuss.elastic.co/u/BenTrent)\
**Post date:** [July 18, 2022, 11:46am UTC](https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840/2 "2022-07-18T11:46:17Z")

</div>

Using pytorch models is a platinum licensed feature.

If you are running some local experiments, you can use a trial.

Here is the API: [Start trial API | Elasticsearch Guide [8.3] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-trial.html)

The call you probably want to make:

```auto
POST /_license/start_trial?acknowledge=true

```

---

<div class="post-metadata">

**Author:** ![green12](https://avatars.discourse-cdn.com/v4/letter/g/58956e/32.png) [@green12](https://discuss.elastic.co/u/green12)\
**Post date:** [July 21, 2022, 2:04am UTC](https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840/3 "2022-07-21T02:04:51Z")

</div>

I see. Thanks a lot for the answer! And also sorry for the late reply.

---

<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:** [August 18, 2022, 2:05am UTC](https://discuss.elastic.co/t/authorization-exception-when-trying-to-import-model-to-elasticsearch-cluster/309840/4 "2022-08-18T02:05:04Z")

</div>

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