Skip to content
Advertisement

How to fix “elasticsearch.exceptions.AuthenticationException: … missing authentication token for REST request”?

I am working on using an ElasticSearch database to store data I am pulling from online. However, when I try to index the data in the database I receive an error.

Here is my code for creating and indexing the data:

JavaScript

However when I run this program, the second of those lines causes an error, here is the complete traceback:

JavaScript

Advertisement

Answer

”missing authentication token’ means you need to authenticate before you can talk to this Elasticsearch instance. To index documents, the user must have write access. You can include a username and password in a URL like this: http://user:password@hostname:port

For example, in a shell:

JavaScript

Then in python:

JavaScript
Advertisement