Пример #1
0
class Picture2(EsfModel):
    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:
        es_index_name = "i_picture2"
        es_doc_type = "t_picture2"
Пример #2
0
class Museum2(EsfModel):
    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:
        es_index_name = "i_museum2"
        es_doc_type = "t_museum2"
Пример #3
0
class Person2(EsfModel):
    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:
        es_index_name = "i_person2"
        es_doc_type = "t_person2"
Пример #4
0
class TestModel(EsfModel):
    name = EsTextField(es_index=True, es_map={'type': 'text'})
    fk = EsForeignKey(TestFk,
                      on_delete=models.CASCADE,
                      null=True,
                      blank=True,
                      default=None,
                      es_index=True,
                      es_map={'type': 'object'})

    class Meta:
        es_index_name = "index_tm"
        es_doc_type = "doc_type_tm"
Пример #5
0
class Author2(EsfModel):
    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:
        es_index_name = "index_with_new_fields2"
        es_doc_type = "type_with_new_fields2"
Пример #6
0
class Address2(EsfModel):
    country = EsTextField()
    city = EsTextField()
    street = EsTextField()
    house = EsTextField()
Пример #7
0
class TestFk(EsfModel):
    text = EsTextField(es_index=True, es_map={'type': 'text'})