class Picture2(DjesModel): name = EsTextField(es_index=True, es_map={'type': 'text'}) auth = EsForeignKey(Author2, on_delete=models.CASCADE, es_index=True, es_map={'type': 'object'}) museum = EsForeignKey(Museum2, on_delete=models.CASCADE, es_index=True, es_map={'type': 'object'}) persons = EsManyToManyField(Person2, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) note = EsTextField(default='', es_index=True, es_map={'type': 'text'}) addr = EsForeignKey(Address2, on_delete=models.CASCADE, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) class Meta: index_using_fields = True mappings = [{ "es_index_name": "i_picture2", "es_doc_type": "t_picture2" }]
class Museum2(DjesModel): name = EsTextField(es_index=True) address = EsForeignKey(Address2, on_delete=models.CASCADE, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) year_foundation = EsIntegerField(es_index=True, es_map={'type': 'integer'}) note = EsTextField(default='', es_index=True, es_map={'type': 'text'}) persona = EsOneToOneField(Person2, on_delete=models.CASCADE, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) class Meta: index_using_fields = True mappings = [{"es_index_name": "i_museum2", "es_doc_type": "t_museum2"}]
class Person2(DjesModel): name = EsTextField(es_index=True, es_map={'type': 'text'}) address = EsForeignKey(Address2, on_delete=models.CASCADE, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) class Meta: index_using_fields = True mappings = [{"es_index_name": "i_person2", "es_doc_type": "t_person2"}]
class TestModel(DjesModel): name = EsTextField(es_index=True, ) fk = EsForeignKey(TestFk, on_delete=models.CASCADE, null=True, blank=True, default=None, es_index=True, es_map={'type': 'object'}) # name = TextField() # fk = ForeignKey(TestFk, on_delete=models.CASCADE, null=True, blank=True, default=None,) class Meta: index_using_fields = False mappings = [ { "es_index_name": "i_test", "es_doc_type": "t_test", "es_mapping": { "testmodel.name": { 'type': 'text' }, "testmodel.fk": { 'type': 'object' }, "testmodel.fk.text": { 'type': 'text' }, }, }, { "es_index_name": "ii_test", "es_doc_type": "tt_test", "es_mapping": { "testmodel.name": { 'type': 'date' }, }, }, ]
class Author2(DjesModel): name = EsTextField(es_index=True, es_map={'type': 'keyword'}) date_birth = EsDateField(es_index=True, es_map={'type': 'text'}) date_death = EsDateField(es_index=True, es_map={'type': 'text'}) country_birth = EsTextField(es_index=True, es_map={'type': 'text'}) note = EsCharField(default='', max_length=10000, es_index=True, es_map={'type': 'text'}) # рассмотрение всех полей field_big_int = EsBigIntegerField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'long'}) field_bin = EsBinaryField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'binary'}) field_null_boolean = EsNullBooleanField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'boolean'}) field_datetime = EsDateTimeField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'date'}) field_decimal = EsDecimalField(null=True, blank=True, default=None, max_digits=10, decimal_places=2, es_index=True, es_map={'type': 'float'}) field_duration = EsDurationField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_email = EsEmailField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_file = EsFileField(default=None, blank=True, null=True, es_index=True, es_map={'type': 'text'}) field_filepath = EsFilePathField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_float = EsFloatField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'float'}) field_image = EsImageField(default=None, blank=True, null=True, es_index=True, es_map={'type': 'text'}) field_generic_ip = EsGenericIPAddressField(default=None, blank=True, null=True, es_index=True, es_map={'type': 'text'}) field_positive_int = EsPositiveIntegerField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'integer'}) field_positive_small_int = EsPositiveSmallIntegerField( null=True, blank=True, default=None, es_index=True, es_map={'type': 'short'}) field_slug = EsSlugField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_small_int = EsSmallIntegerField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'short'}) field_time = EsTimeField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_url = EsURLField(null=True, blank=True, default=None, es_index=True, es_map={'type': 'text'}) field_uuid = EsUUIDField(null=True, blank=True, default=uuid.uuid4, editable=False, es_index=True, es_map={'type': 'text'}) class Meta: index_using_fields = True mappings = [{ "es_index_name": "index_with_new_fields2", "es_doc_type": "type_with_new_fields2" }]
class Address2(DjesModel): country = EsTextField() city = EsTextField() street = EsTextField() house = EsTextField()
class TestFk(DjesModel): text = EsTextField(es_index=True, es_map={'type': 'text'})