From 762a0fe8a1ad8dd88969f598a04d0440b0e216a6 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 11 Dec 2022 14:57:39 +0700 Subject: [PATCH] add default sort _doc in IndexPaginate --- tubearchivist/home/src/es/connect.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tubearchivist/home/src/es/connect.py b/tubearchivist/home/src/es/connect.py index 75ab6a9a..aac13dcc 100644 --- a/tubearchivist/home/src/es/connect.py +++ b/tubearchivist/home/src/es/connect.py @@ -125,8 +125,7 @@ class IndexPaginate: def validate_data(self): """add pit and size to data""" if "sort" not in self.data.keys(): - print(self.data) - raise ValueError("missing sort key in data") + self.data.update({"sort": [{"_doc": {"order": "desc"}}]}) self.data["size"] = self.size or self.DEFAULT_SIZE self.data["pit"] = {"id": self.pit_id, "keep_alive": "10m"}