# Elasticsearch, I am missing authentication Token for REST request

**URL:** <https://discuss.elastic.co/t/elasticsearch-i-am-missing-authentication-token-for-rest-request/93213>\
**Category:** Elasticsearch\
**Created:** [July 14, 2017, 3:26pm UTC](https://discuss.elastic.co/t/elasticsearch-i-am-missing-authentication-token-for-rest-request/93213 "2017-07-14T15:26:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Professor\_Joykill](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@Professor\_Joykill](https://discuss.elastic.co/u/Professor_Joykill)\
**Post date:** [July 14, 2017, 3:26pm UTC](https://discuss.elastic.co/t/elasticsearch-i-am-missing-authentication-token-for-rest-request/93213/1 "2017-07-14T15:26:22Z")

</div>

Hi, I just started working with elasticsearch and am trying to use it to index data in a database using th `index()` command, here is the code I use to set up and then index:

```
es = Elasticsearch()
es.index(index='weather', doc_type='data', body=doc)

```

However when running this I receive an error, here is the complete traceback:

```
Traceback (most recent call last):
File "weatherScraper.py", line 79, in <module>
  main()
File "weatherScraper.py", line 73, in main
  es.index(index='weather', doc_type='data', body=doc)
File "/home/alec/.local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 73, in _wrapped
  return func(*args, params=params, **kwargs)
File "/home/alec/.local/lib/python2.7/site-packages/elasticsearch/client/ __init__.py", line 298, in index
  _make_path(index, doc_type, id), params=params, body=body)
File "/home/alec/.local/lib/python2.7/site-packages/elasticsearch/transport.py", line 312, in perform_request
  status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/home/alec/.local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 128, in perform_request
  self._raise_error(response.status, raw_data)
File "/home/alec/.local/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 125, in _raise_error
  raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.AuthenticationException: TransportError(401, u'security_exception', u'missing authentication token for REST request [/weather/data]')
```

---

<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 11, 2017, 3:26pm UTC](https://discuss.elastic.co/t/elasticsearch-i-am-missing-authentication-token-for-rest-request/93213/2 "2017-08-11T15:26:24Z")

</div>

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