MàJ ElasticSearch

This commit is contained in:
Robin Champenois 2021-06-28 21:44:47 +02:00
parent 1956f38176
commit 3c2f93bccb

View file

@ -1,4 +1,4 @@
from django_elasticsearch_dsl import DocType, Index, fields from django_elasticsearch_dsl import Document, Index, fields
from elasticsearch_dsl import analyzer, token_filter, tokenizer from elasticsearch_dsl import analyzer, token_filter, tokenizer
from .models import Stage, AvisStage, AvisLieu from .models import Stage, AvisStage, AvisLieu
@ -21,19 +21,19 @@ text_analyzer = analyzer(
stage.analyzer(text_analyzer) stage.analyzer(text_analyzer)
@stage.doc_type @stage.doc_type
class StageDocument(DocType): class StageDocument(Document):
lieux = fields.ObjectField(properties={ lieux = fields.ObjectField(properties={
'nom': fields.StringField(), 'nom': fields.TextField(),
'ville': fields.StringField(), 'ville': fields.TextField(),
'pays': fields.StringField(), 'pays': fields.TextField(),
}) })
auteur = fields.ObjectField(properties={ auteur = fields.ObjectField(properties={
'nom': fields.StringField(), 'nom': fields.TextField(),
}) })
thematiques = fields.StringField() thematiques = fields.TextField()
matieres = fields.StringField() matieres = fields.TextField()
class Meta: class Django:
model = Stage model = Stage
fields = [ fields = [
'sujet', 'sujet',