title: Changing index name to alias name in documents.py for django_elasticsearch_dsl
body: <p>I'm using the python client of django-elasticsearch and got a particularly weird error. Here is my setup:</p>
  <p>I have an index named &quot;information_documents&quot; in ES, and I created an alias called &quot;info&quot; that contains this index only.</p>
  <pre><code>&quot;information_documents&quot;: {
          &quot;aliases&quot;: {
              &quot;info&quot;: {}
          }
      }
  </code></pre>
  <p>I have a class &quot;InfoDocument&quot; defined in documents.py, and this is the type of the data I have in my ES database, from which I am searching. I now try to change the name in the index subclass from the index name(&quot;information_documents&quot;) to the alias name(&quot;info&quot;).</p>
  <pre><code>class InfoDocument(Document):
  
    class Index:
      # Name of the Elasticsearch index
      name = 'info'
  </code></pre>
  <p>Doing that caused something weir for me, when I call:</p>
  <pre><code>from documents import InfoDocument
  documents = InfoDocument.search()
  for doc in documents:
     #do something
     doc.save()
  </code></pre>
  <p>Apparently when the name in InfoDocument.index is the index name, the type of doc is:</p>
  <pre><code>&quot;documents.InfoDocument&quot;
  </code></pre>
  <p>but when I change it to the alias name, the type is</p>
  <pre><code>&quot;elasticserch_dsl.response.hit.Hit&quot;
  </code></pre>
  <p>Therefore, it triggers error</p>
  <pre><code>&quot;Object Hit has no attribute 'save'&quot;
  </code></pre>
  <p>However, when I check the type of &quot;documents&quot;, its type is consistently</p>
  <pre><code>&quot;django_elasticsearch_dsl.search.Search&quot;
  </code></pre>
  <p>Why would the iteration of objects of the same type resulting in two completely different types? I would really appreciate if someone could educate me on this.</p>
  <p>Also this is my first time posting on stackoverflow so please also tell me if any part of my question could be improved! I'll be more than happy to fix it :)</p>