# Authentication Error setting up Eland on Jupyter Notebook

**URL:** <https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 6, 2023, 7:42am UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404 "2023-09-06T07:42:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xynobob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xynobob/32/105064_2.png) [@xynobob](https://discuss.elastic.co/u/xynobob)\
**Post date:** [September 6, 2023, 7:42am UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404/1 "2023-09-06T07:42:12Z")

</div>

Hi, I am trying to use Eland on Jupyter Notebook. Here is what I wrote on Jupyter

```auto
import eland as ed
import pandas as pd
import numpy as np
from elasticsearch import Elasticsearch

def json(x):
    import json
    print(json.dumps(x, indent=2, sort_keys=True))

es = Elasticsearch(
    cloud_id="<cloud id>",
    basic_auth=("<username>", "<password>")
)

json(es.info())

```

However upon 'Run' this is the error I got -

```auto
AuthenticationException: AuthenticationException(401, 'security_exception', 'unable to authenticate user [username] for REST request [/]')

```

What am I doing wrong here as I indicated the username & password that I use to login to Elastic Cloud portal, but seems to not able to work. Also used _basic\_auth_ instead of _http\_auth_ that was shown on the [video](https://www.youtube.com/watch?v=U8fnkzp_sfo&ab_channel=Elastic) demo by Elastic that I followed, as it indicated that http\_auth has been deprecated.

---

<div class="post-metadata">

**Author:** ![Quentin\_Pradet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quentin_pradet/32/94192_2.png) [@Quentin\_Pradet](https://discuss.elastic.co/u/Quentin_Pradet)\
**Post date:** [September 6, 2023, 8:10am UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404/2 "2023-09-06T08:10:03Z")

</div>

Hello, and thank you for your interest in Eland!

As you have realized, you should not use your Elastic Cloud password, but your Elasticsearch password. A common choice is the `elastic` user: its password was shown to you when you created the deployment, but you can also generate a new one: [Reset the elastic user password | Elasticsearch Service Documentation | Elastic](https://www.elastic.co/guide/en/cloud/current/ec-password-reset.html).

Then you can indeed use `basic_auth=("elastic", "password")` which is correct.

Note that the warnings in the docs above apply: for better security consider using an API key or an user account with less privileges. See [Connecting | Elasticsearch Python Client [8.9] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html#authentication) for how to use those authentication methods using the Elasticsearch Python client that Eland relies on.

---

<div class="post-metadata">

**Author:** ![xynobob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xynobob/32/105064_2.png) [@xynobob](https://discuss.elastic.co/u/xynobob)\
**Post date:** [September 6, 2023, 10:53am UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404/3 "2023-09-06T10:53:34Z")

</div>

Hi Quentin, that works flawlessly! Didn't know I have to use Elasticsearch password instead of Elastic Cloud. Thanks.

Also, on a separate note, I managed to pull data successfully unto Jupyter if I used  
`df = ed.Dataframe(es, "logs-aws*")` however the moment I used  
`df = ed.Dataframe(es, "logs-*")`, I received the error below. May I know why is this so?

```auto
<directory>\field_mappings.py:324: UserWarning: Field message has conflicting types ('match_only_text', None) != text
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field host.os.name.text has conflicting types ('text', None) != match_only_text
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field error.message has conflicting types ('match_only_text', None) != keyword
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field event.dataset has conflicting types ('constant_keyword', None) != keyword
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field event.ingested has conflicting types ('date', 'strict_date_time_no_millis||strict_date_optional_time||epoch_millis') != keyword
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field destination.as.organization.name.text has conflicting types ('match_only_text', None) != text
  warnings.warn(
<directory>\field_mappings.py:324: UserWarning: Field destination.user.name.text has conflicting types ('match_only_text', None) != text
  warnings.warn(
......

```

---

<div class="post-metadata">

**Author:** ![Quentin\_Pradet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quentin_pradet/32/94192_2.png) [@Quentin\_Pradet](https://discuss.elastic.co/u/Quentin_Pradet)\
**Post date:** [September 6, 2023, 1:06pm UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404/4 "2023-09-06T13:06:56Z")

</div>

When converting indices to a dataframe representation, Eland needs to figure out what is the type of each column. It uses the [Elasticsearch mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) to do so. And then, for example, the `integer` Elasticsearch type gets mapped to the `int64` pandas type.

This is fine for your `logs-aws*` indices. But what should happen when you ask for multiple indices that use _different_ mappings, such as your `logs-*` indices that apparently include more indices than just `logs-aws-*`? There can be only one type in a given dataframe. So what Eland does is that it takes the first definition and sticks with it. If it then finds another index with a different types, it ignores it but warns you about it. This is what you've seen. It's only a warning,

(An additional issue here is that Eland does not know about `match_only_text` and `constant_keyword` yet, so it maps them to `object` in Pandas.)

In your case, the `message` field was first seen as `match_only_text` and presumably mapped to `object` in Pandas, but then another index had it mapped as `text`, but that is ignored and Eland is telling you that.

If it does not cause any issues for you, you can ignore the warnings.

---

<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:** [October 4, 2023, 1:07pm UTC](https://discuss.elastic.co/t/authentication-error-setting-up-eland-on-jupyter-notebook/342404/5 "2023-10-04T13:07:32Z")

</div>

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