from django_elasticsearch_dsl import DocType, Index
from bluebottle.projects.models import  Project

# The name of your index
project = Index('projects')
# See Elasticsearch Indices API reference for available settings
project.settings(
    number_of_shards=1,
    number_of_replicas=0
)


@project.doc_type
class ProjectDocument(DocType):
    class Meta:
        model = Project
        fields = [
            'title',
            'story',
            'pitch',
        ]

from django_elasticsearch_dsl import DocType

from bluebottle.projects.models import Project
from bluebottle.utils.documents import MultiTenantIndex

# The name of your index
project = MultiTenantIndex('projects')
# See Elasticsearch Indices API reference for available settings
project.settings(
    number_of_shards=1,
    number_of_replicas=0
)


@project.doc_type
class ProjectDocument(DocType):
    class Meta:
        model = Project
        fields = [
            'title',
            'story',
            'pitch',
        ]

Use a different index for different tenants
Use a different index for different tenants

- from django_elasticsearch_dsl import DocType, Index
+ from django_elasticsearch_dsl import DocType
+ 
- from bluebottle.projects.models import  Project
+ from bluebottle.projects.models import Project
+ from bluebottle.utils.documents import MultiTenantIndex
  
  # The name of your index
- project = Index('projects')
+ project = MultiTenantIndex('projects')
  # See Elasticsearch Indices API reference for available settings
  project.settings(
      number_of_shards=1,
      number_of_replicas=0
  )
  
  
  @project.doc_type
  class ProjectDocument(DocType):
      class Meta:
          model = Project
          fields = [
              'title',
              'story',
              'pitch',
          ]
  
Use a different index for different tenants
## Code Before:
from django_elasticsearch_dsl import DocType, Index
from bluebottle.projects.models import  Project

# The name of your index
project = Index('projects')
# See Elasticsearch Indices API reference for available settings
project.settings(
    number_of_shards=1,
    number_of_replicas=0
)


@project.doc_type
class ProjectDocument(DocType):
    class Meta:
        model = Project
        fields = [
            'title',
            'story',
            'pitch',
        ]

## Instruction:
Use a different index for different tenants
## Code After:
from django_elasticsearch_dsl import DocType

from bluebottle.projects.models import Project
from bluebottle.utils.documents import MultiTenantIndex

# The name of your index
project = MultiTenantIndex('projects')
# See Elasticsearch Indices API reference for available settings
project.settings(
    number_of_shards=1,
    number_of_replicas=0
)


@project.doc_type
class ProjectDocument(DocType):
    class Meta:
        model = Project
        fields = [
            'title',
            'story',
            'pitch',
        ]
