title: Time-Based Indexing in Elasticsearch in python? like daily logs date suffix index
body: <p>i am developing a 3rd party tool which is fetching report data from apis, i am indexing this in elastic search using </p>
  
  <blockquote>
    <p><code>django_elasticsearch_dsl</code></p>
  </blockquote>
  
  <p>But every time i  index the fetched data it overrides the previous one.
  one approach was mentioned in the documentation help 
  i.e We can store index fer day with date as suffix in index name.</p>
  
  <p>For example: </p>
  
  <blockquote>
    <p>index_name = report-yyyymmdd-hhmmss</p>
  </blockquote>
  
  <p>How to do this in python using django_elasticsearch_dsl?
  What is the best practice to do this?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class ReportDocument(Document):
  
      def prepare_labels(self, instance):
          if instance.labels == '--':
              return ''
          return list(map(str.strip, eval(instance.labels)))
  
      class Index:
          name = "report1"
          settings = {
              'number_of_shards': 1,
              'number_of_replicas': 0
          }
  
      class Django:
          model = Report
          fields = [
              field.name for field in Report._meta.get_fields()]
          auto_refresh = False
  </code></pre>