From b29273629e7b04305b038dd5df91940900cddc17 Mon Sep 17 00:00:00 2001 From: liangliang Date: Wed, 14 Jul 2021 22:28:42 +0800 Subject: [PATCH] update mapping --- blog/documents.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blog/documents.py b/blog/documents.py index 44486c2..8e117b9 100644 --- a/blog/documents.py +++ b/blog/documents.py @@ -14,7 +14,7 @@ import elasticsearch.client from elasticsearch_dsl.connections import connections import time from blog.models import Article -from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint +from elasticsearch_dsl import Document, InnerDoc, Date, Integer, Long, Text, Object, GeoPoint, Keyword from django.conf import settings @@ -45,18 +45,18 @@ if ELASTICSEARCH_ENABLED: class GeoIp(InnerDoc): - continent_name = Text() - country_iso_code = Text() - country_name = Text() + continent_name = Keyword() + country_iso_code = Keyword() + country_name = Keyword() location = GeoPoint() class ElapsedTimeDocument(Document): - url = Text() + url = Keyword() time_taken = Long() log_datetime = Date() useragent = Text(analyzer='ik_max_word', search_analyzer='ik_smart') - ip = Text() + ip = Keyword() geoip = Object(GeoIp, required=False) class Index: