We have Kubernetes based Elasticsearch 8.9.2 cluster, which I'm trying to write to using django-elasticsearch-dsl library.
Following is my django model
class TestModel(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=200, null=False, blank=False)
Following is my Document object defined in app/documents.py
from django_elasticsearch_dsl import Document, Index, fields
from django_elasticsearch_dsl import fields
from django_elasticsearch_dsl.registries import registry
from .models import TestModel
@registry.register_document
class TestModelDocument(Document):
uuid = fields.TextField()
name = fields.TextField()
class Index:
name = "testmodel_index"
settings = {
"number_of_shards": 3,
"number_of_replicas": 3,
'analysis': {
'analyzer': {
'default': {
'type': 'default'
},
'edge_ngram_analyzer': {
'type': 'custom',
'tokenizer': 'standard',
}
}
}
}
#52267c9d-5001-4174-b098-44f0023d6f60 0ec6d0f9-639b-4863-b018-e471cb5b31be
class Django:
model = TestModel
fields=[]
After this when I run following command on terminal, with --create option, it correctly creates index with 3 replicas and shards, but if I use --populate option directly without first creating the underlying index, number of shards and replicas setting in documents.py is ignored and set to 1 instead.
We have Kubernetes based Elasticsearch 8.9.2 cluster, which I'm trying to write to using django-elasticsearch-dsl library. Following is my django model
Following is my Document object defined in app/documents.py
After this when I run following command on terminal, with --create option, it correctly creates index with 3 replicas and shards, but if I use --populate option directly without first creating the underlying index, number of shards and replicas setting in documents.py is ignored and set to 1 instead.
python3 manage.py search_index --create --models metadata.TestModel >>>> correctly sets 3 replica and 3 shards
Has anyone else encountered same issue? if anyone knows the fix, kindly share it here?