ElasticSearch tutorial. Getting ValueError from bulk_indexing()

ElasticSearch fcc tutorial

I am trying to go through the tutorial at

I am completely new to ElasticSearch. The tutorial connects a Django app to ElasticSearch

I haven’t finished the tut. I am stuck at the first attempt at indexing. The tutorial asks to run it from the Django shell

>>>from elasticsearchapp.search import *

It is raising a ValueError (copied in full below). The ValueError is:

You cannot perform API calls on the default index.

I am running on Windows with ElasticSearch running as a service and python 3.8.5

The bulk_indexing method looks like:

def bulk_indexing():
    es = Elasticsearch()

    # Hand BlogPost to bulk and define a generator for actions
    bulk(client=es, actions=(b.indexing() for b in models.BlogPost.objects.all().iterator()))

And here is the entire Traceback

Traceback (most recent call last):
File “”, line 1, in
File “C:\python\E\dj\elastics\elasticsearchproject\elasticsearchapp\search.py”, line 21, in bulk_indexing
File “C:\python\E\dj\dvenv\lib\site-packages\elasticsearch_dsl\document.py”, line 156, in init
File “C:\python\E\dj\dvenv\lib\site-packages\elasticsearch_dsl\index.py”, line 298, in save
if not self.exists(using=using):
File “C:\python\E\dj\dvenv\lib\site-packages\elasticsearch_dsl\index.py”, line 414, in exists
return self._get_connection(using).indices.exists(index=self._name, **kwargs)
File “C:\python\E\dj\dvenv\lib\site-packages\elasticsearch_dsl\index.py”, line 134, in _get_connection
raise ValueError(“You cannot perform API calls on the default index.”)
ValueError: You cannot perform API calls on the default index.

Any help is appreciated. For example, how can I choose or create an index other than the default index

Hi pentsok

I am going through the tutorial and am having the exact same issue.

Did you find a resolution?