From cc0fe8bee14daff1138075f5e69cc75f8f049fbd Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Tue, 27 Apr 2021 15:12:19 -0400 Subject: [PATCH] Adding doc type for both stories and feeds. --- apps/search/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/search/models.py b/apps/search/models.py index b8d2782fd..33e582b88 100644 --- a/apps/search/models.py +++ b/apps/search/models.py @@ -281,7 +281,7 @@ class SearchStory: "date" : story_date, } try: - cls.ES().create(index=cls.index_name(), id=story_hash, body=doc) + cls.ES().create(index=cls.index_name(), id=story_hash, body=doc, doc_type='stories-type') except (elasticsearch.exceptions.ConnectionError, urllib3.exceptions.NewConnectionError) as e: logging.debug(f" ***> ~FRNo search server available for story indexing: {e}") @@ -329,7 +329,7 @@ class SearchStory: 'size': limit } try: - results = cls.ES().search(body=body, index=cls.index_name()) + results = cls.ES().search(body=body, index=cls.index_name(), doc_type='stories-type') except elasticsearch.exceptions.RequestError as e: logging.debug(" ***> ~FRNo search server available for querying: %s" % e) return [] @@ -515,7 +515,7 @@ class SearchFeed: "num_subscribers": num_subscribers, } try: - cls.ES().create(index=cls.index_name(), id=feed_id, body=doc, doc_type='stories-type') + cls.ES().create(index=cls.index_name(), id=feed_id, body=doc, doc_type='feeds-type') except (elasticsearch.exceptions.ConnectionError, urllib3.exceptions.NewConnectionError) as e: logging.debug(f" ***> ~FRNo search server available for feed indexing: {e}") @@ -551,7 +551,7 @@ class SearchFeed: 'sort': [{'num_subscribers': {'order': 'desc'}}], } try: - results = cls.ES().search(body=body, index=cls.index_name(), doc_type='stories-type') + results = cls.ES().search(body=body, index=cls.index_name(), doc_type='feeds-type') except elasticsearch.exceptions.RequestError as e: logging.debug(" ***> ~FRNo search server available for querying: %s" % e) return []