update settings, update establishment document

This commit is contained in:
evgeniy-st 2019-09-16 11:21:14 +03:00
parent 8e864d32b9
commit db5ff7afcd
5 changed files with 29 additions and 11 deletions

View File

@ -14,7 +14,6 @@ EstablishmentIndex.settings(number_of_shards=1, number_of_replicas=1)
class EstablishmentDocument(Document):
"""Establishment document."""
name = fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES)
description = fields.ObjectField(properties=OBJECT_FIELD_PROPERTIES)
tags = fields.ObjectField(
properties={
@ -28,14 +27,12 @@ class EstablishmentDocument(Document):
model = models.Establishment
fields = (
'id',
'name',
'public_mark',
'toque_number',
'price_level',
)
def prepare_name(self, instance):
return instance.name
def prepare_description(self, instance):
return instance.description

View File

@ -43,7 +43,6 @@ class NewsDocumentSerializer(DocumentSerializer):
class EstablishmentDocumentSerializer(DocumentSerializer):
"""Establishment document serializer."""
name_translated = serializers.SerializerMethodField(allow_null=True)
description_translated = serializers.SerializerMethodField(allow_null=True)
class Meta:
@ -57,15 +56,10 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
'public_mark',
'toque_number',
'price_level',
'name_translated',
'description_translated',
'tags',
)
@staticmethod
def get_name_translated(obj):
return get_translated_value(obj.name)
@staticmethod
def get_description_translated(obj):
return get_translated_value(obj.description)

View File

@ -56,7 +56,6 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
'price_level',
)
translated_search_fields = (
'name',
'description',
)
filter_fields = {

View File

@ -11,3 +11,17 @@ SCHEMA_URI = 'http'
DEFAULT_SUBDOMAIN = 'www'
SITE_DOMAIN_URI = 'id-east.ru'
DOMAIN_URI = 'gm.id-east.ru'
# ELASTICSEARCH SETTINGS
ELASTICSEARCH_DSL = {
'default': {
'hosts': 'localhost:9200'
}
}
ELASTICSEARCH_INDEX_NAMES = {
'search_indexes.documents.news': 'development_news',
'search_indexes.documents.establishment': 'development_establishment',
}

View File

@ -11,3 +11,17 @@ SCHEMA_URI = 'https'
DEFAULT_SUBDOMAIN = 'www'
SITE_DOMAIN_URI = 'id-east.ru'
DOMAIN_URI = 'gm-stage.id-east.ru'
# ELASTICSEARCH SETTINGS
ELASTICSEARCH_DSL = {
'default': {
'hosts': 'localhost:9200'
}
}
ELASTICSEARCH_INDEX_NAMES = {
'search_indexes.documents.news': 'stage_news',
'search_indexes.documents.establishment': 'stage_establishment',
}