add default sort _doc in IndexPaginate

This commit is contained in:
simon 2022-12-11 14:57:39 +07:00
parent 0d21bfe929
commit 762a0fe8a1
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 1 additions and 2 deletions

View File

@ -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"}